:root {
    /* Colors matches Widget */
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --accent: #ec4899;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --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);

    /* Typography */
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.container {
    width: min(100% - 32px, 1200px);
    margin: 0 auto;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Main content area - desktop gets padding, mobile overrides in app.css */
.app-main {
    padding: 40px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    background: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    padding: 0.85rem 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px -5px rgba(0, 0, 0, 0.05);

    /* Sticky positioning */
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Hamburger Toggle (Hidden on Desktop) */
.nav-toggle {
    display: none;
}

.nav-left,
.nav-middle,
.nav-right {
    display: flex;
    align-items: center;
}

.nav-middle {
    flex: 1;
    justify-content: center;
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-color);
    letter-spacing: -0.01em;
}

.nav-right {
    gap: 0.5rem;
}

@media (max-width: 900px) {
    .navbar {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        /* Allow wrapping for menu */
        justify-content: space-between;
        /* Space out logo and toggle */
        align-items: center;
        gap: 0;
        position: sticky;
        top: 0;
        z-index: 1000;
    }

    .nav-left {
        width: auto;
        justify-content: flex-start;
    }

    /* Toggle Button Style */
    .nav-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        color: #1e293b;
        /* Fallback text color */
        cursor: pointer;
        padding: 8px;
        /* Bigger hit area */
        z-index: 20;
    }

    .nav-right {
        width: 100%;
        display: none;
        /* Hide by default */
        flex-direction: column;
        align-items: center;
        gap: 10px;
        order: 3;
        /* Below logo and toggle */
        margin-top: 15px;
        padding-top: 15px;
        border-top: 1px solid #f1f5f9;
        animation: slideDown 0.2s ease-out;
    }

    /* Show menu when open */
    .navbar.nav-open .nav-right {
        display: flex;
    }

    .nav-right .nav-link,
    .nav-right .nav-btn,
    .nav-right a {
        width: 100%;
        text-align: center;
        justify-content: center;
        margin: 0;
        display: block;
        box-sizing: border-box;
        padding: 12px;
    }

    .logo {
        font-size: 1.25rem;
    }

    .nav-middle {
        display: none;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

.logo {
    font-weight: 800;
    font-size: 1.4rem;
    color: var(--primary);
    text-decoration: none;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--primary), #818cf8);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-link {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.9rem;
    padding: 8px 14px;
    border-radius: 8px;
}

.nav-link:hover {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

/* Button variants for the header */
.nav-link.btn-primary-sm {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.nav-link.btn-primary-sm:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.3);
}

.nav-link.btn-ghost-sm {
    color: var(--text-muted);
}

.nav-link.btn-ghost-sm:hover {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
}

.nav-link.btn-outline-sm {
    border: 1.5px solid var(--border-color);
    color: var(--text-color);
}

.nav-link.btn-outline-sm:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: transparent;
}

/* Footer */
.footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 1rem 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: auto;
}

.footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--primary);
    text-decoration: underline;
}

@media (max-width: 600px) {
    .footer .container {
        flex-direction: column;
        text-align: center;
    }
}

/* Buttons */
.btn-primary {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.8rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-cta {
    background-color: #10b981;
    color: white;
    border: 1px solid #10b981;
    padding: 0.75rem 1.8rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-cta:hover {
    background-color: #059669;
    border-color: #059669;
    box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.3);
}

/* Nav Buttons */
.nav-btn {
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-block;
}

.btn-secondary {
    background-color: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-secondary:hover {
    background-color: #f1f5f9;
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--accent);
    /* Using accent for logout */
    color: var(--accent);
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-outline:hover {
    background: var(--accent);
    color: white;
}

.btn-primary-sm {
    background-color: var(--primary);
    color: white;
}

.btn-primary-sm:hover {
    background-color: var(--primary-hover);
}

/* Fix Navbar Links on Mobile */
@media (max-width: 900px) {
    .nav-links div {
        flex-direction: row;
        /* Keep buttons in row if possible, or wrap */
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    #userName {
        display: none;
        /* Hide name on small screens to save space */
    }
}