/* Layout and Navigation styles - Core page structure and navigation components */
/* Optimized from 384 → 228 lines | Components extracted to /components/ */

/* Consolidated dark mode overrides */
[data-theme="dark"] .navbar {
    background-color: rgba(2, 6, 23, 0.75);
    border-bottom-color: rgba(148, 163, 184, 0.2);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

[data-theme="dark"] .container::before {
    display: none;
}

/* Navigation */
.navbar {
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--navbar-height);
    background-color: var(--overlay-medium);
    border-bottom: 1px solid var(--overlay-subtle);
    z-index: 1000;
    padding: 0 1.5rem 0.5rem;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    display: flex;
    align-items: flex-end;
    will-change: transform;
    overflow: visible;
    isolation: isolate;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

/* PWA safe-area support with CSS custom properties */
@supports (padding: env(safe-area-inset-top)) {
    :root {
        --safe-area-top: env(safe-area-inset-top, 0px);
        --safe-area-left: env(safe-area-inset-left, 0px);
        --safe-area-right: env(safe-area-inset-right, 0px);
        --safe-area-bottom: env(safe-area-inset-bottom, 0px);
        --header-total-height: calc(var(--header-height) + var(--safe-area-top));
    }

    /* PWA standalone mode adjustments */
    @media all and (display-mode: standalone) {
        .navbar {
            height: var(--header-total-height);
            padding-top: var(--safe-area-top);
            transform: translateZ(0);
            -webkit-transform: translateZ(0);
        }

        .nav-content {
            height: 2.5rem;
            padding-left: max(1.5rem, var(--safe-area-left));
            padding-right: max(1.5rem, var(--safe-area-right));
        }

        .container {
            padding-top: calc(var(--header-total-height) + 1rem);
        }

        /* Mobile PWA adjustments */
        @media (max-width: 768px) {
            body, html {
                height: 100%;
                overflow-x: hidden;
                background-color: var(--background) !important;
            }

            /* Removed hardcoded black background - now uses CSS variable */

            .navbar {
                padding-left: max(1rem, var(--safe-area-left));
                padding-right: max(1rem, var(--safe-area-right));
                padding-bottom: 0.25rem;
            }

            .nav-content {
                height: 2.25rem;
                gap: 0.75rem;
            }
        }
    }

    .container {
        padding-left: max(2rem, var(--safe-area-left));
        padding-right: max(2rem, var(--safe-area-right));
        padding-bottom: max(2rem, var(--safe-area-bottom));
    }
}

.nav-content {
    max-width: var(--max-width);
    margin: 0 auto;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    width: 100%;
}

.nav-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    position: relative;
    padding: 0 0.75rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.nav-logo:hover {
    background-color: var(--surface-hover);
    transform: translateY(-1px);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-right: auto;
    height: 100%;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9375rem;
    transition: color 0.2s ease;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 0.5rem;
}

.nav-links a:hover {
    color: var(--text);
}

.nav-links a.active {
    color: var(--primary);
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-right: 0;
    padding-right: 0.75rem;
    border-right: 1px solid var(--border);
    height: 2.25rem;
}

/* Main container - Responsive padding with clamp() */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: clamp(1rem, 2vw, 2rem);
    position: relative;
    z-index: 1;
}

.container::before {
    content: "";
    position: absolute;
    inset: 1rem;
    border-radius: 2rem;
    background: var(--overlay-light);
    box-shadow: inset 0 1px 0 var(--overlay-subtle);
    opacity: 0.3;
    pointer-events: none;
    z-index: -1;
}

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
    margin-bottom: 2.25rem;
    padding: 2rem;
    border-radius: 1.75rem;
    background: var(--surface-hero, var(--gradient-hero));
    box-shadow: var(--surface-hero-glow, var(--shadow-lg));
    border: 1px solid var(--surface-hero-border, var(--border));
    position: relative;
    overflow: hidden;
}

.page-header::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 20%, var(--overlay-subtle), transparent 45%);
    opacity: 0.4;
    pointer-events: none;
}

.header-content {
    position: relative;
    z-index: 1;
    max-width: 540px;
}

.header-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.subtitle {
    font-size: 1rem;
    color: var(--color-text-secondary);
    max-width: 40rem;
    line-height: 1.6;
}

[data-theme="dark"] .subtitle {
    color: rgba(255, 255, 255, 0.85);
}

/* App wrapper */
.app-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Feed container */
.feed-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

/* Responsive layout adjustments */
@media (max-width: 1024px) {
    .page-header {
        flex-direction: column;
        gap: 1.5rem;
        align-items: stretch;
    }
}

@media (max-width: 768px) {
    .page-header {
        margin-bottom: 1.5rem;
        padding: 1.5rem;
    }

    .header-content h1 {
        font-size: 2rem;
    }

    .nav-content {
        gap: 1rem;
    }

    .nav-links {
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .header-content h1 {
        font-size: 1.75rem;
    }
}
