/* Global Reset */
:root {
    --bg-body: #ffffff;
    --bg-secondary: #f9fafb;
    --text-main: #111827;
    --text-dim: #6b7280;
    --text-light: #9ca3af;

    --accent: #2563eb;
    /* Vivid Blue */
    --accent-glow: rgba(37, 99, 235, 0.15);
    --accent-hover: #1d4ed8;

    --border: #e5e7eb;
    --card-bg: #ffffff;
    --nav-bg: rgba(255, 255, 255, 0.85);
    /* Glassy White */

    --font-heading: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Menlo', monospace;

    --sidebar-width: 260px;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: var(--font-heading);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
    transition: 0.2s;
}

ul {
    list-style: none;
}

/* ----------------------------------------------------
   Background FX (Clean & Modern)
   ---------------------------------------------------- */
.glow-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    background:
        radial-gradient(circle at 10% 20%, rgba(37, 99, 235, 0.04), transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.04), transparent 40%);
}

/* Subtle grid pattern for tech feel */
.glow-bg::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
    z-index: -1;
}

/* ----------------------------------------------------
   Navigation 
   ---------------------------------------------------- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    display: flex;
    align-items: center;
}

.nav-content {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: var(--text-dim);
    font-size: 0.9rem;
    font-weight: 500;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--accent);
}

/* ----------------------------------------------------
   Layout for Subpages
   ---------------------------------------------------- */
.app-layout {
    display: flex;
    min-height: 100vh;
    padding-top: 64px;
}

/* Sidebar Styling - Light Mode */
.sidebar {
    width: var(--sidebar-width);
    position: fixed;
    top: 64px;
    bottom: 0;
    left: 0;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 2rem 0;
    z-index: 90;
    /* Clean scrollbar */
    scrollbar-width: thin;
    scrollbar-color: #e5e7eb transparent;
}

.sidebar-content {
    padding: 0 1.25rem;
}

.sidebar-group {
    margin-bottom: 2rem;
}

.sidebar-heading {
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: 0.75rem;
    padding-left: 0.75rem;
}

.sidebar-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    color: var(--text-dim);
    font-size: 0.9rem;
    border-radius: 6px;
    margin-bottom: 2px;
}

.sidebar-link:hover {
    background: var(--bg-secondary);
    color: var(--text-main);
}

.sidebar-link.active {
    background: var(--accent-glow);
    color: var(--accent);
    font-weight: 600;
}

.link-id {
    font-size: 0.75rem;
    color: var(--text-light);
    font-family: var(--font-mono);
}

/* Main Content Styling */
.content-area {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    padding: 1rem 2rem;
    min-height: 80vh;
}

.page-header {
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
    padding-top: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.breadcrumbs {
    color: var(--text-light);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.breadcrumbs a:hover {
    color: var(--accent);
}

.comp-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -0.03em;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.comp-tag {
    font-size: 0.8rem;
    background: var(--accent-glow);
    padding: 4px 10px;
    border-radius: 99px;
    color: var(--accent);
    font-weight: 600;
    vertical-align: middle;
}

.comp-id {
    margin-bottom: 1rem;
    color: var(--text-light);
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.comp-desc {
    font-size: 1.1rem;
    color: var(--text-dim);
    max-width: 700px;
    line-height: 1.6;
}

/* ----------------------------------------------------
   Homepage Hero & Cards
   ---------------------------------------------------- */
.hero {
    padding: 160px 20px 100px;
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 4.5rem;
    line-height: 1.1;
    font-weight: 900;
    margin-bottom: 1.5rem;
    color: var(--text-main);
    letter-spacing: -0.04em;

    /* Subtle gradient text */
    background: linear-gradient(180deg, #111827 0%, #4b5563 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-fill-color: transparent;
    color: transparent;

    animation: fadeForwards 0.8s ease-out forwards;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-dim);
    max-width: 600px;
    margin: 0 auto 3rem;
    animation: fadeForwards 0.8s ease-out 0.2s forwards;
    opacity: 0;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    animation: fadeForwards 0.8s ease-out 0.4s forwards;
    opacity: 0;
}

.btn {
    padding: 0.8rem 2.5rem;
    border-radius: 99px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-primary {
    background: var(--text-main);
    color: white;
    border: 1px solid var(--text-main);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: black;
}

.btn-secondary {
    background: white;
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--text-dim);
    background: var(--bg-secondary);
}

.features-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: center;
    gap: 2rem;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto 6rem;
}

.feature-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 2rem;
    border-radius: 12px;
    transition: all 0.3s ease;
    flex: 1 1 300px;
    max-width: 380px;
    min-height: 200px;
}

.feature-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
}

.feature-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    font-weight: 700;
    color: var(--text-main);
}

.feature-card p {
    color: var(--text-dim);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* ----------------------------------------------------
   Tables & Code 
   ---------------------------------------------------- */
.section-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2.5rem;
    box-shadow: var(--shadow-sm);
}

.section-card h2 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 0.9rem;
}

tr:last-child td {
    border-bottom: none;
}

.prop-name code {
    background: var(--accent-glow);
    color: var(--accent);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
}

.code-block-wrapper {
    background: #f8f9fa;
    /* Light code block bg */
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
}

/* Ensure dark text for code in light theme */
pre code {
    font-family: var(--font-mono);
    color: #333;
    font-size: 0.9rem;
}

@keyframes fadeForwards {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Badge colors for Component types */
.badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    border: 1px solid;
    font-weight: 500;
}

.badge-string {
    background: #ecfdf5;
    color: #059669;
    border-color: transparent;
}

.badge-boolean {
    background: #fffbeb;
    color: #d97706;
    border-color: transparent;
}

.badge-number {
    background: #f5f3ff;
    color: #7c3aed;
    border-color: transparent;
}

.badge-object {
    background: #fdf2f8;
    color: #db2777;
    border-color: transparent;
}

/* ----------------------------------------------------
   Shell / Iframe Layout (New)
   ---------------------------------------------------- */
.shell-container {
    display: flex;
    height: calc(100vh - 64px);
    margin-top: 64px;
    overflow: hidden;
    background: var(--bg-body);
}

.shell-sidebar {
    width: var(--sidebar-width);
    height: 100%;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    background: #fff;
    scrollbar-width: thin;
    padding: 2rem 0;
}

.shell-main {
    flex: 1;
    display: flex;
    height: 100%;
    overflow: hidden;
}

.doc-frame-wrapper {
    flex: 1;
    height: 100%;
    position: relative;
    background: var(--bg-body);
}

.doc-frame {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.mobile-preview-wrapper {
    width: 415px;
    border-left: 1px solid var(--border);
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem;
    position: relative;
    box-shadow: inset 10px 0 20px -10px rgba(0, 0, 0, 0.02);
}

.mobile-mockup {
    width: 375px;
    height: 100%;
    max-height: 812px;
    background: #fff;
    border-radius: 40px;
    box-shadow:
        0 0 0 12px #1f2937,
        0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    position: relative;
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
}

/* Phone Status Bar - Modern iOS Style */
.phone-status-bar {
    height: 34px;
    background: rgb(14, 99, 255);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    flex-shrink: 0;
    z-index: 30;
    pointer-events: none;
    /* Let clicks pass through to iframe if needed */
}

.status-left {
    flex: 1;
    display: flex;
    align-items: center;
}

.status-time {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    margin-left: 10px;
}

/* Dynamic Island (灵动岛) */
.status-notch {
    width: 110px;
    height: 24px;
    background: #000;
    border-radius: 20px;
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.status-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-right: 10px;
}

.status-icon {
    color: #fff;
    opacity: 0.9;
}

/* Battery Icon */
.battery-icon {
    width: 22px;
    height: 10px;
    border: 1.5px solid #fff;
    border-radius: 3px;
    position: relative;
    opacity: 0.9;
}

.battery-icon::after {
    content: '';
    position: absolute;
    right: -4px;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 5px;
    background: #fff;
    border-radius: 0 2px 2px 0;
}

.battery-level {
    position: absolute;
    left: 1px;
    top: 1px;
    bottom: 1px;
    width: 70%;
    background: #34d399;
    /* Green battery */
    border-radius: 1px;
}

.preview-frame {
    flex: 1;
    width: 100%;
    border: none;
    background: #fff;
    padding-top: 34px;
    /* Space for the floating status bar */
    box-sizing: border-box;
}

.preview-label {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
}

.designer-btn {
    text-decoration: none;
    color: #fff;
    background: var(--accent);
    padding: 4px 12px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
    cursor: pointer;
}

.designer-btn:hover {
    background: #0052d4;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(14, 99, 255, 0.3);
}

.designer-btn:active {
    transform: translateY(0);
}

.designer-btn svg {
    opacity: 0.9;
}

/* Adjust Content Area for Iframe usage */
.iframe-content-mode .content-area {
    margin-left: 0;
    width: 100%;
    padding: 2rem 3rem;
    min-height: auto;
}

.iframe-content-mode .page-header {
    margin-top: 0;
    padding-top: 0;
}


/* Designer Modal Styles */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease-out;
}

.modal-container {
    background: #fff;
    width: 95%;
    height: 95%;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #1e293b;
    font-weight: 600;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #64748b;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.close-modal:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.modal-body {
    flex: 1;
    width: 100%;
    background: #fff;
    position: relative;
}

.modal-body iframe {
    width: 100%;
    height: 100%;
    border: none;
}

#world {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}