/* --- Unified Design System | Glassmorphism --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Colors */
    --bg-dark: #121212;
    --bg-gradient-1: #1e293b;
    --bg-gradient-2: #121212;

    --accent-primary: #3b82f6;
    --accent-hover: #2563eb;
    --accent-dark: #1d4ed8;
    --accent-subtle: rgba(59, 130, 246, 0.1);
    --accent-glow: rgba(59, 130, 246, 0.3);

    --text-main: #f8fafc;
    --text-muted: #94a3b8;

    --success: #22c55e;
    --error: #ef4444;
    --warning: #fbbf24;

    /* Glass Effect */
    --glass-bg: rgba(18, 18, 18, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --backdrop-blur: 16px;

    /* Spacing & Layout */
    --container-width: 1200px;
    --radius-lg: 16px;
    --radius-md: 8px;
    --radius-full: 50px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #0a0a0a;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(59, 130, 246, 0.12) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(139, 92, 246, 0.12) 0%, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

/* --- Utilities --- */
.container {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.hidden {
    display: none !important;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero-bg {
    background-color: var(--bg-dark);
    background-image:
        radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.15) 0%, transparent 40%);
    background-attachment: fixed;
}

.iridescent-text {
    /* Digital Shimmer: Blue -> Cyan -> White -> Cyan -> Blue */
    background: linear-gradient(110deg,
            #3b82f6 20%,
            #22d3ee 40%,
            #ffffff 50%,
            #22d3ee 60%,
            #3b82f6 80%);
    background-size: 200% auto;
    animation: iridescent-shift 3s linear infinite;

    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    /* Fallback */

    /* Crisp Digital Glow */
    filter: drop-shadow(0 0 10px rgba(34, 211, 238, 0.5));
}

/* --- Components --- */

/* Buttons */
.btn-primary {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-ghost:hover {
    border-color: var(--text-muted);
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

/* Glass Card */
.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    backdrop-filter: blur(var(--backdrop-blur));
    -webkit-backdrop-filter: blur(var(--backdrop-blur));
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* Inputs */
.input-group {
    margin-bottom: 1.25rem;
    width: 100%;
}

.input-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: rgba(0, 0, 0, 0.3);
}

/* --- Pages Explained --- */

/* 1. Landing Page (Hero) */
.hero-section {
    position: fixed;
    inset: 0;
    background-color: var(--bg-dark);
    background-image:
        radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.15) 0%, transparent 40%);
    /* Removed background-attachment: fixed to allow bg to slide with element */

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem;
    z-index: 20;
    transition: transform 0.8s cubic-bezier(0.7, 0, 0.3, 1);
}

.hero-section.slide-out {
    transform: translateY(100%);
    /* Slides down to reveal demo behind */
}

.hero-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 2rem;

    /* Iridescent Style now via .iridescent-text utility, but keeping here for legacy if needed or mixin */
    background: linear-gradient(110deg,
            #3b82f6 20%,
            #22d3ee 40%,
            #ffffff 50%,
            #22d3ee 60%,
            #3b82f6 80%);
    background-size: 200% auto;
    animation: iridescent-shift 3s linear infinite;

    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;

    letter-spacing: -0.02em;
    white-space: nowrap;

    /* Crisp Digital Glow */
    filter: drop-shadow(0 0 10px rgba(34, 211, 238, 0.5));
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 3rem;
    max-width: 500px;
}

/* 2. Admin Panel Layout */
.navbar {
    width: 100%;
    padding: 1rem 2rem;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
}

.nav-logo {
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: 0.1em;
    color: white;
}

.nav-divider {
    width: 1px;
    height: 16px;
    background: var(--glass-border);
    margin: 0 1rem;
}

#user-email {
    cursor: default;
    color: white;
    opacity: 0.8;
}

.nav-logout {
    color: var(--error);
}

.nav-menu {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-item {
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    transition: color 0.2s;
}

.nav-item:hover,
.nav-item.active {
    color: white;
}

.admin-content {
    max-width: 600px;
    margin: 4rem auto;
    padding: 0 1rem;
}

/* 3. Demo Shell (Top Bar) */
.demo-bar {
    position: relative;
    /* Rest in flow above iframe */
    width: 100%;
    height: 40px;
    /* Slimmer */
    background: #0a0a0a;
    /* Darker charcoal/black */
    border-bottom: 1px solid rgba(59, 130, 246, 0.3);
    /* Subtle electric blue */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 1000;

    /* Glass Effect */
    background: rgba(10, 10, 10, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
}

.demo-bar-actions {
    display: flex;
    gap: 1rem;
}

/* 4. Feedback Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-box {
    width: 90%;
    max-width: 480px;
    background: #0f172a;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s;

    /* Glass Effect (Match .glass-card) */
    background: var(--glass-bg);
    backdrop-filter: blur(var(--backdrop-blur));
    -webkit-backdrop-filter: blur(var(--backdrop-blur));
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.modal-overlay.active .modal-box {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}

/* States */
.error-banner {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    padding: 0.8rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    display: none;
}

/* --- Buttons --- */
.btn-primary {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 0.875rem 1.75rem;
    background: var(--accent-dark);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    /* Ensure Inter font matches */
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.4s ease;
}

.btn-primary:hover {
    background: var(--accent-primary);
    transform: none;
    /* Explicitly disable any raise effect */
    box-shadow:
        0 0 15px rgba(59, 130, 246, 0.5),
        0 0 30px rgba(59, 130, 246, 0.3),
        0 0 45px rgba(59, 130, 246, 0.1);
}

/* Mobile Responsive Fixes */
@media (max-width: 768px) {
    .hero-title {
        /* Fluid scaling: min 1.2rem, preferred 5vw, max 1.8rem */
        font-size: clamp(1.2rem, 5vw, 1.8rem);
        letter-spacing: 0.08em;
        white-space: normal;
        /* Allow wrapping if needed */
        word-break: break-word;
        max-width: 100%;
        /* Ensure it never exceeds container */
    }

    /* Mobile Admin Nav */
    .navbar {
        flex-direction: column;
        padding: 1rem;
        height: auto;
        gap: 1rem;
    }

    .nav-logo {
        font-size: 1.25rem;
        letter-spacing: 0.05em;
        margin-bottom: 0.25rem;
    }

    .nav-menu {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 1rem;
    }

    .nav-divider,
    #user-email {
        display: none;
    }

    .nav-item {
        margin-right: 0 !important;
        /* Override inline styles/head styles */
        font-size: 0.85rem;
    }

    .hero-subtitle {
        font-size: 0.95rem;
        margin-bottom: 2rem;
    }

    .hero-section {
        padding: 1rem;
    }

    .glass-card {
        padding: 1.5rem;
        max-width: calc(100vw - 2rem);
        /* Prevent horizontal overflow */
        margin: 0 auto;
        box-sizing: border-box;
    }
}

/* Extra small screens (iPhone SE, very narrow devices) */
@media (max-width: 380px) {
    .hero-title {
        font-size: clamp(1rem, 4.5vw, 1.4rem);
        letter-spacing: 0.05em;
    }

    .glass-card {
        padding: 1rem;
    }

    .btn-primary {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
}

/* Portrait mode (narrow + tall screens like vertical monitors) */
@media (max-width: 1024px) and (orientation: portrait) {
    .navbar {
        flex-direction: column;
        padding: 0.75rem 1rem;
        height: auto;
        gap: 0.75rem;
        align-items: center;
    }

    .nav-logo {
        font-size: 1.25rem;
        letter-spacing: 0.1em;
        text-align: center;
    }

    .nav-menu {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.75rem 1.25rem;
        /* row gap, column gap */
    }

    .nav-item {
        font-size: 0.85rem;
        padding: 0.25rem 0.5rem;
        white-space: nowrap;
        /* Prevent text wrapping within items */
    }

    .nav-item::after {
        bottom: -0.5rem !important;
    }

    .nav-divider {
        display: none;
    }

    #user-email {
        display: none;
    }
}

/* 5. Animations */
@keyframes iridescent-shift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

@keyframes energy-pulse {
    0% {
        box-shadow: 0 0 5px var(--accent-primary);
        background: var(--accent-subtle);
    }

    50% {
        box-shadow: 0 0 25px var(--accent-primary), 0 0 45px rgba(59, 130, 246, 0.4);
        background: var(--accent-primary);
    }

    100% {
        box-shadow: 0 0 5px var(--accent-primary);
        background: var(--accent-primary);
    }
}

.btn-charged {
    animation: energy-pulse 1.5s infinite;
    color: white !important;
    border-color: transparent;
}

/* --- Floating Navigation (Home & Admin) --- */
.floating-nav {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    z-index: 25;
}

.nav-icon-link {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary);
    opacity: 0.7;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-icon-link svg {
    width: 28px;
    height: 28px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-icon-link:hover {
    opacity: 1;
    transform: scale(1.15);
    filter: drop-shadow(0 0 12px rgba(59, 130, 246, 0.6)) drop-shadow(0 0 24px rgba(59, 130, 246, 0.3));
}

.home-icon-link:hover svg {
    color: #60a5fa;
    /* Lighter electric blue on hover */
}

/* Hide home icon when overlay slides out */
.hero-section.slide-out .home-icon-link {
    opacity: 0;
    pointer-events: none;
}