/* ============================================
   Layout — Grid, Nav, Footer, Page Layouts
   ============================================ */

/* ---------- Container ---------- */
.container {
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--space-6);
    padding-right: var(--space-6);
}

.container-sm {
    max-width: 640px;
}

.container-md {
    max-width: 960px;
}

.container-lg {
    max-width: 1200px;
}

.container-xl {
    max-width: 1400px;
}

.container-fluid {
    max-width: 100%;
    padding-left: var(--space-6);
    padding-right: var(--space-6);
}

/* ---------- Grid ---------- */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-left: calc(var(--space-4) * -1);
    margin-right: calc(var(--space-4) * -1);
}

.row > [class*="col"] {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
}

.col-1  { flex: 0 0 8.33%; max-width: 8.33%; }
.col-2  { flex: 0 0 16.67%; max-width: 16.67%; }
.col-3  { flex: 0 0 25%; max-width: 25%; }
.col-4  { flex: 0 0 33.33%; max-width: 33.33%; }
.col-5  { flex: 0 0 41.67%; max-width: 41.67%; }
.col-6  { flex: 0 0 50%; max-width: 50%; }
.col-7  { flex: 0 0 58.33%; max-width: 58.33%; }
.col-8  { flex: 0 0 66.67%; max-width: 66.67%; }
.col-9  { flex: 0 0 75%; max-width: 75%; }
.col-10 { flex: 0 0 83.33%; max-width: 83.33%; }
.col-11 { flex: 0 0 91.67%; max-width: 91.67%; }
.col-12 { flex: 0 0 100%; max-width: 100%; }
.col    { flex: 1 1 0%; }

/* Grid gap utilities */
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* Auto grid */
.grid-auto {
    display: grid;
    gap: var(--space-6);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }

/* ---------- Navigation ---------- */
.site-nav {
    background: var(--bg-nav);
    border-bottom: 1px solid var(--gray-800);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    backdrop-filter: blur(12px);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--white);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.nav-brand:hover {
    color: var(--white);
}

.nav-brand svg,
.nav-brand i {
    color: var(--accent);
    font-size: 1.4rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    list-style: none;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    font-weight: 400;
    color: var(--gray-400);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.nav-link:hover {
    color: var(--white);
    background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    color: var(--white);
    font-weight: 500;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* Nav dropdown */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + var(--space-2));
    right: 0;
    min-width: 220px;
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: var(--space-2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--transition-fast);
    z-index: var(--z-dropdown);
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    color: var(--text-primary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.nav-dropdown-item:hover {
    background: var(--bg-inset);
}

.nav-dropdown-divider {
    border: none;
    border-top: 1px solid var(--border-default);
    margin: var(--space-2) 0;
}

.nav-dropdown-label {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-weight: 500;
}

/* Credits badge in nav */
.nav-credits {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 0.2em 0.5em;
    font-size: var(--text-xs);
    font-weight: 500;
    background: var(--gray-800);
    color: var(--gray-300);
    border-radius: var(--radius-full);
}

.nav-credits.low {
    background: var(--error-soft);
    color: var(--error);
}

/* Mobile nav toggle */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--gray-400);
    font-size: 1.5rem;
    cursor: pointer;
    padding: var(--space-2);
}

/* Theme toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    background: transparent;
    border: 1px solid var(--gray-700);
    border-radius: var(--radius-md);
    color: var(--gray-400);
    cursor: pointer;
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    border-color: var(--gray-500);
    color: var(--white);
}

/* ---------- Footer ---------- */
.site-footer {
    background: var(--bg-footer);
    border-top: 1px solid var(--gray-800);
    color: var(--gray-400);
    padding: var(--space-16) 0 var(--space-8);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr repeat(4, 1fr);
    gap: var(--space-8);
    margin-bottom: var(--space-12);
}

.footer-brand {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--white);
    margin-bottom: var(--space-3);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.footer-brand i {
    color: var(--accent);
}

.footer-desc {
    font-size: var(--text-sm);
    color: var(--gray-500);
    line-height: 1.7;
    max-width: 320px;
}

.footer-heading {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--gray-300);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: var(--space-4);
}

.footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.footer-link {
    font-size: var(--text-sm);
    color: var(--gray-500);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer-link:hover {
    color: var(--white);
}

.footer-bottom {
    padding-top: var(--space-8);
    border-top: 1px solid var(--gray-800);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--text-xs);
    color: var(--gray-600);
}

/* ---------- Page Layouts ---------- */

/* Auth pages layout (login, register, etc.) */
.auth-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 200px);
    padding: var(--space-8) var(--space-4);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: var(--space-10);
    box-shadow: var(--shadow-lg);
}

.auth-card h1 {
    font-size: var(--text-2xl);
    text-align: center;
    margin-bottom: var(--space-8);
}

/* Two-column sidebar layout */
.layout-sidebar {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: var(--space-8);
    padding: var(--space-8) 0;
}

.layout-sidebar .sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.layout-sidebar .main-content {
    min-width: 0;
}

/* Hero section */
.hero {
    background: var(--gray-900);
    color: var(--white);
    position: relative;
    overflow: hidden;
}

.hero-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-12);
    align-items: center;
    padding: var(--space-20) 0;
}

.hero h1 {
    font-size: var(--text-5xl);
    color: var(--white);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: var(--space-6);
}

.hero p {
    font-size: var(--text-lg);
    color: var(--gray-400);
    margin-bottom: var(--space-8);
    line-height: 1.7;
}

.hero-actions {
    display: flex;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.hero-proof {
    display: flex;
    gap: var(--space-6);
    font-size: var(--text-sm);
    color: var(--gray-500);
}

.hero-proof span {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* Waveform visualization */
.hero-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.waveform-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    gap: 3px;
    padding: var(--space-10);
    background: var(--gray-850);
    border-radius: var(--radius-2xl);
    border: 1px solid var(--gray-700);
    width: 100%;
}

/* Trust bar */
.trust-bar {
    background: var(--gray-850);
    border-top: 1px solid var(--gray-800);
    border-bottom: 1px solid var(--gray-800);
    padding: var(--space-6) 0;
}

.trust-items {
    display: flex;
    justify-content: center;
    gap: var(--space-12);
}

.trust-item {
    text-align: center;
}

.trust-value {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--white);
}

.trust-label {
    font-size: var(--text-sm);
    color: var(--gray-500);
}

/* Section headers */
.section-header {
    text-align: center;
    max-width: 640px;
    margin: 0 auto var(--space-12);
}

.section-header h2 {
    margin-bottom: var(--space-4);
}

.section-header p {
    font-size: var(--text-lg);
    color: var(--text-muted);
}

/* CTA section */
.cta-section {
    background: var(--gray-900);
    color: var(--white);
    text-align: center;
    padding: var(--space-20) 0;
}

.cta-section h2 {
    color: var(--white);
    margin-bottom: var(--space-4);
}

.cta-section p {
    color: var(--gray-400);
    font-size: var(--text-lg);
    margin-bottom: var(--space-8);
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .footer-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .footer-grid > :first-child {
        grid-column: 1 / -1;
    }

    .layout-sidebar {
        grid-template-columns: 240px 1fr;
        gap: var(--space-6);
    }
}

@media (max-width: 768px) {
    .container {
        padding-left: var(--space-4);
        padding-right: var(--space-4);
    }

    /* Stack columns on mobile */
    .row { flex-direction: column; }
    .row > [class*="col"] { max-width: 100%; flex: none; }

    /* Responsive grid */
    .grid-2, .grid-3, .grid-4, .grid-6 {
        grid-template-columns: 1fr;
    }

    /* Nav mobile */
    .nav-toggle { display: block; }

    .nav-links {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--gray-900);
        border-bottom: 1px solid var(--gray-800);
        flex-direction: column;
        padding: var(--space-4);
    }

    .nav-links.open {
        display: flex;
    }

    .nav-right {
        gap: var(--space-2);
    }

    /* Hero mobile */
    .hero-inner {
        grid-template-columns: 1fr;
        padding: var(--space-12) 0;
        text-align: center;
    }

    .hero h1 {
        font-size: var(--text-3xl);
    }

    .hero-actions {
        flex-direction: column;
        align-items: center;
    }

    .hero-proof {
        justify-content: center;
        flex-wrap: wrap;
    }

    .hero-visual {
        display: none;
    }

    /* Trust bar */
    .trust-items {
        gap: var(--space-6);
        flex-wrap: wrap;
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-6);
    }

    .footer-bottom {
        flex-direction: column;
        gap: var(--space-4);
        text-align: center;
    }

    /* Sidebar layout stacks */
    .layout-sidebar {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-6 { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 769px) {
    .row { flex-direction: row; }
}
