/* --- Base Styles & Branding (Unity Pro/Cyan Scheme) --- */
:root {
    --bs-body-bg: #1c1c1c;          
    --bs-body-color: #e0e0e0;       
    --bs-tertiary-bg: #2b2b2b;      
    --bs-secondary-bg: #222222;     
    --bs-border-color: rgba(255, 255, 255, 0.1);     
    --bs-primary: #0ea5e9;          
    --bs-primary-hover: #38bdf8;
    --bs-primary-rgb: 14, 165, 233;
    --bs-secondary: #9ca3af;        
    --bs-danger: #ef4444;           
    --bs-success: #10b981;
    --bs-warning: #f59e0b;
    --bs-info: #06b6d4;
    --accent-secondary: #0284c7;
    --accent-gradient: linear-gradient(135deg, #0ea5e9, #0284c7);
    --surface-elevated: rgba(255, 255, 255, 0.04);
    --surface-hover: rgba(255, 255, 255, 0.08);
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --sidebar-width: 80px;
}

* { box-sizing: border-box; }

body { 
    margin: 0; background-color: var(--bs-body-bg); color: var(--bs-body-color); 
    display: flex; flex-direction: column; height: 100vh; overflow: hidden; 
    -webkit-font-smoothing: antialiased; font-family: var(--font-sans);
}

/* Subtle dark radial gradient for depth, removing the purple/indigo */
body::before {
    content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    z-index: -1; background: radial-gradient(circle at 50% 0%, rgba(14, 165, 233, 0.05) 0%, #1c1c1c 70%);
}

/* --- Scrollbar Styles --- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background-color: rgba(255, 255, 255, 0.12); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 255, 255, 0.2); }

.screen { 
    flex: 1; display: none; flex-direction: column; 
    z-index: 1; width: 100%; height: 100%;
}
.screen.active { display: flex; animation: screenFadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1); }

@keyframes screenFadeIn {
    from { opacity: 0; transform: translateY(15px); filter: blur(8px); }
    to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* --- Top Navigation --- */
.top-nav {
    position: sticky;
    top: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    /* Fluid horizontal padding tracks viewport width instead of jumping at a
       single breakpoint, keeping the bar balanced at every size. */
    padding: 0.75rem clamp(1rem, 4vw, 3rem);
    background: rgba(34, 34, 34, 0.85);
    border-bottom: 1px solid var(--bs-border-color);
    backdrop-filter: blur(12px);
    z-index: 100;
}

.top-nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    flex: 0 0 auto; /* never shrink or wrap when the menu grows */
}

.top-nav-brand-logo {
    width: auto;
    height: 36px;
    display: block; /* removes the inline-image baseline gap */
}

.top-nav-brand-name {
    font-size: 1.2rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.05em;
}

.top-nav-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--bs-body-color);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
}

.top-nav-toggle:hover {
    background-color: var(--surface-hover);
    color: #fff;
}

/* Two groups — navigation and actions — so the CTA is visually separated from
   the page links instead of sitting in the same evenly spaced run. */
.top-nav-links {
    display: flex;
    align-items: center;
    gap: clamp(1rem, 3vw, 2.5rem);
}

.top-nav-menu {
    display: flex;
    align-items: center;
    gap: clamp(0.75rem, 2vw, 1.75rem);
}

.top-nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.top-nav-link {
    position: relative;
    color: var(--bs-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    /* Padding gives the hover/active states room to breathe and enlarges the
       click target beyond the bare text. */
    padding: 0.4rem 0.25rem;
    transition: color 0.2s;
}

.top-nav-link:hover,
.top-nav-link:focus-visible {
    color: #fff;
}

.top-nav-link.is-active {
    color: #fff;
}

/* Underline marks the current page; scaleX keeps it off the layout so links
   never shift when the indicator appears. */
.top-nav-link::after {
    content: '';
    position: absolute;
    left: 0.25rem;
    right: 0.25rem;
    bottom: 0;
    height: 2px;
    border-radius: 2px;
    background: var(--bs-primary);
    transform: scaleX(0);
    transition: transform 0.2s ease;
}

.top-nav-link.is-active::after,
.top-nav-link:hover::after {
    transform: scaleX(1);
}

.top-nav-cta {
    white-space: nowrap;
}

/* The Buy Me a Coffee script injects an image with its own margins; neutralize
   them so it aligns with the rest of the action group. */
.bmc-btn-container {
    display: flex;
    align-items: center;
}

.bmc-btn-container img,
.bmc-btn-container a {
    margin: 0 !important;
    vertical-align: middle;
}

/* --- Login Screen (Hero Split Layout) --- */
#screen-login {
    flex-direction: column;
    padding: 0;
    max-width: none;
    align-items: stretch;
    justify-content: center;
}

.hero-split {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    align-items: center;
    gap: 2rem;
    max-width: 1200px;
    width: 100%;
    margin: 1.5rem auto 2rem;
    padding: 0 2rem;
}

.hero-split-copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.hero-title-lg {
    font-size: 2.75rem;
    font-weight: 800;
    color: #fff;
    margin: 0 0 0.75rem;
    line-height: 1.15;
    letter-spacing: -0.03em;
}
.hero-title-lg span { color: var(--bs-primary); }

.hero-desc-lg {
    color: var(--bs-body-color);
    font-size: 1.05rem;
    line-height: 1.65;
    margin: 0 0 1.25rem;
    max-width: 480px;
    opacity: 0.85;
}

.hero-split-visual {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--bs-border-color);
    background: var(--bs-tertiary-bg);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.35);
}

.hero-preview-img {
    display: block;
    width: 100%;
    height: auto;
}

.hero-preview-placeholder {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    aspect-ratio: 16/11;
    color: var(--bs-secondary);
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

/* --- Authentication Hub --- */
.login-cta-area {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem;
    width: 100%;

}

.google-auth-wrapper {
    display: flex; justify-content: center; align-items: center;
    transition: transform 0.3s;
    min-height: 50px;
    width: 100%;
}
.google-auth-wrapper:hover { transform: scale(1.02); }

#captcha-container {
    width: 100%;
    padding: 1rem;
    background: var(--surface-elevated);
    border: 1px solid var(--bs-border-color);
    border-radius: 12px;
    margin-bottom: 0.75rem;
}

#captcha-question { font-family: var(--font-mono); }

/* --- Shared Components --- */
.radar-spinner { width: 70px; height: 70px; margin-bottom: 1rem; border-radius: 50%; border: 3px solid transparent; border-top-color: var(--bs-primary); animation: radarSpin 1.5s infinite linear; position: relative; }
@keyframes radarSpin { to { transform: rotate(360deg); } }
.btn { border: none; border-radius: 8px; font-weight: 700; font-size: 0.95rem; cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 0.75rem 1.5rem; text-decoration: none; }
.btn-primary { background: var(--bs-primary); color: white; }
.btn-primary:hover { background: var(--bs-primary-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25); }
.btn-ghost { background: transparent; color: var(--bs-body-color); border: 1px solid var(--bs-border-color); }
.btn-ghost:hover { border-color: rgba(14, 165, 233, 0.4); color: #fff; background: rgba(14, 165, 233, 0.08); }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.85rem; border-radius: 6px; }
.btn-danger { background: rgba(239, 68, 68, 0.12); color: var(--bs-danger); border: 1px solid rgba(239, 68, 68, 0.2); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.2); }

.form-control {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--bs-border-color);
    color: white;
    padding: 0.625rem 0.875rem;
    border-radius: 6px;
    outline: none;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus { border-color: var(--bs-primary); box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.15); }
.form-control::placeholder { color: var(--bs-secondary); }

/* --- Status Badges --- */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.status-badge.active { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.status-badge.revoked { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.status-badge.expired { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }

/* --- Modal Styles --- */
.custom-modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease-out;
}

.custom-modal {
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 12px;
    padding: 1.5rem;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.2s ease-out;
}

.custom-modal-title {
    margin: 0 0 0.75rem;
    font-size: 1.25rem;
    color: #fff;
    font-weight: 700;
}

.custom-modal-message {
    margin: 0 0 1rem;
    color: var(--bs-body-color);
    line-height: 1.5;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

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

/* --- Extracted Layout & Utility Classes --- */
.layout-container {
    display: flex;
    flex: 1;
    height: calc(100vh - 61px);
    overflow: hidden;
    width: 100%;
}

.content-wrapper {
    /*height: 100%;*/
    width: 100%;
}

.bmc-btn-container {
    display: flex;
    align-items: center;
    transform: scale(0.85);
    margin-right: 10px;
}

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

.hidden-state {
    display: none;
}

/* --- Mobile Responsive Rules --- */
@media (max-width: 768px) {
    .top-nav {
        padding: 0.5rem 1.25rem;
        position: relative;
    }

    /* The brand sits beside the hamburger on narrow screens, so the wordmark
       steps down to keep the row from crowding at ~360px. */
    .top-nav-brand-logo {
        height: 30px;
    }

    .top-nav-brand-name {
        font-size: 1rem;
    }

    .top-nav-toggle {
        display: flex;
    }
    
    .top-nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(34, 34, 34, 0.98);
        backdrop-filter: blur(15px);
        border-bottom: 1px solid var(--bs-border-color);
        padding: 1rem;
        gap: 1rem;
        z-index: 1000;
        align-items: stretch;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    }
    
    .top-nav-links.active {
        display: flex;
    }
    
    /* The desktop layout groups links and actions side by side; in the mobile
       dropdown both groups must stack full width instead. */
    .top-nav-menu,
    .top-nav-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        width: 100%;
    }

    .top-nav-actions {
        gap: 0.75rem;
        margin-top: 0.75rem;
    }

    .top-nav-links .top-nav-link {
        padding: 0.75rem 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    /* The sliding underline reads as a stray line in a stacked menu; the
       active row is marked with colour alone here. */
    .top-nav-links .top-nav-link::after {
        display: none;
    }

    .top-nav-links .btn {
        width: 100%;
        justify-content: center;
    }

    .bmc-btn-container {
        justify-content: center;
    }
    
    .bmc-btn-container {
        justify-content: center;
        margin-right: 0;
        margin-top: 0.5rem;
    }

    .hero-split {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        padding: 0 1rem;
        margin: 1rem auto 1.5rem;
    }

    .hero-split-copy {
        align-items: center;
        text-align: center;
    }

    .hero-desc-lg {
        max-width: none;
    }

    .login-cta-area {
        align-items: center;
    }

    .google-auth-wrapper {
        justify-content: center;
    }

    .hero-split-visual {
        order: -1;
    }

    .hero-title-lg {
        font-size: 2.25rem;
    }

    .hero-desc-lg {
        font-size: 1rem;
        margin-bottom: 1rem;
    }
}

@media (max-width: 480px) {
    .hero-title-lg {
        font-size: 1.85rem;
    }
}
