@font-face {
    font-family: 'Lexend Deca';
    src: url('fonts/LexendDeca-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
}

:root {
    /* EXACT BRAND COLORS FROM LOGO */
    --brand-navy: #001f4d;
    --brand-blue: #0070f3; /* Brighter, more vibrant blue for Dark Mode */
    
    --bg-color: #0b0e14;
    --card-bg: rgba(22, 27, 34, 0.7);
    --text-primary: #ffffff;
    --text-secondary: #8b949e;
    --primary-color: var(--brand-blue); 
    --primary-hover: #3291ff;
    --border-color: rgba(255, 255, 255, 0.1);
    --input-bg: #161b22;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

[data-theme="light"] {
    --brand-blue: #0059b3; /* Professional navy blue for Light Mode */
    --primary-color: #0059b3; /* Explicitly redefine for light mode */
    --primary-hover: #004d99;
    --bg-color: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.9);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --border-color: rgba(0, 0, 0, 0.1);
    --input-bg: #ffffff;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    
    /* Light mode sidebar overrides */
    --brand-navy: #f1f5f9; 
    --nav-hover: rgba(0, 0, 0, 0.05);
}




* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Lexend Deca', Calibri, sans-serif;
}

body {
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(0, 89, 179, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(0, 89, 179, 0.05) 0px, transparent 50%);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s, color 0.3s;
}

/* LANDING PAGE HERO */
.hero {
    text-align: center;
    padding: 6rem 1rem;
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--brand-blue), #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
[data-theme="light"] .hero h1 {
    background: linear-gradient(135deg, var(--brand-navy), var(--brand-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
@media (max-width: 768px) {
    .hero h1 { font-size: 2.2rem; }
    .hero p { font-size: 1rem; }
}
.hero p {
    color: var(--text-secondary);
    font-size: 1.2rem;
    line-height: 1.6;
    margin-bottom: 2.5rem;
}

/* FOOTER */
footer.site-footer {
    margin-top: auto;
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Make logo remain consistent and support text fallbacks */
.logo {
    height: 32px;
    width: auto;
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: -0.04em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    filter: brightness(1.5) saturate(1.8) drop-shadow(0 0 10px rgba(0, 89, 179, 0.4));
    transition: all 0.3s ease;
    object-fit: contain;
    user-select: none;
}

[data-theme="light"] .logo {
    filter: none;
    color: var(--brand-blue); /* Distinct color for light mode brand */
}


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

header {
    width: 100%;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: none !important;
    overflow: visible;
}

@media (max-width: 600px) {
    header {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    .header-actions {
        width: 100%;
        justify-content: center;
        gap: 0.5rem;
    }
    #logout-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
    }
}



.theme-toggle {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    margin-bottom: 0.5rem;
}
.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--primary-color);
}
.theme-toggle svg, .nav-link svg {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px;
    flex-shrink: 0;
}
.theme-toggle .moon-icon, .theme-toggle .sun-icon {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 500;
}



/* AUTHENTICATION & SPA ALIGNMENT */
.container {
    max-width: 1400px;
    margin: 2rem auto;
    width: 100%;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.auth-container {
    max-width: 400px;
    margin: 4rem auto;
    width: 100%;
    display: none;
}

/* CARDS & PANELS */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

/* ADMIN DASHBOARD - NEW SIDEBAR ARCHITECTURE */
.admin-shell {
    display: flex;
    flex-direction: row;
    min-height: 100vh;
    overflow-x: hidden;
}


.sidebar {
    width: 260px;
    min-width: 260px;
    background: var(--brand-navy);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 1000;
    transition: transform 0.3s, left 0.3s;
}


.sidebar-nav {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.2s;
    cursor: pointer;
    font-weight: 500;
}

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


.nav-link.active {
    border-left: 4px solid var(--brand-blue);
    background: rgba(0, 89, 179, 0.1);
}

.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
}

/* TAB VISIBILITY SYSTEM */
.tab-pane {
    display: none;
}
.tab-pane.active {
    display: block !important;
}


/* MOBILE NAV */
.mobile-header {
    display: none;
    padding: 0.75rem 1.25rem;
    background: var(--brand-navy);
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
}


@media (max-width: 1100px) {
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        z-index: 10000;
        box-shadow: 20px 0 50px rgba(0,0,0,0.5);
    }
    .sidebar.open {
        transform: translateX(260px);
    }
    .mobile-header {
        display: flex;
        z-index: 9000;
    }
    .mobile-only {
        display: block !important;
    }
    .main-content {
        padding: 1.5rem;
        margin-top: 60px; /* Offset for mobile header */
    }
    .user-row {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1rem;
    }
    .user-row > div:last-child {
        width: 100%;
        justify-content: space-between;
    }
}


.mobile-only {
    display: none;
}


/* USAGE PULSE */
.pulse-box {
    width: 10px;
    height: 10px;
    background: #10b981;
    border-radius: 50%;
    position: relative;
    box-shadow: 0 0 10px #10b981;
}
.pulse-box::after {
    content: '';
    position: absolute;
    width: 100%; height: 100%;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(2.5); opacity: 0; }
}

/* FORMS */
.form-group {
    margin-bottom: 1rem;
    position: relative;
}
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.form-group input, .admin-shell input[type="text"], .admin-shell input[type="email"], .admin-shell input[type="password"], .admin-shell textarea, .admin-shell select {
    width: 100%;
    padding: 0.75rem;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    outline: none;
    transition: border 0.2s, background 0.2s;
    font-size: 0.9rem;
}
.form-group input:focus, .admin-shell input:focus, .admin-shell textarea:focus {
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.02);
}

.password-toggle {
    position: absolute;
    right: 12px;
    bottom: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    transition: color 0.2s;
}

.password-toggle:hover {
    color: var(--primary-color);
}
.password-toggle svg {
    width: 18px;
    height: 18px;
}

button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
}
button:hover { background: var(--primary-hover); }

/* FULLSCREEN PORTAL MODE */
body.portal-open {
    overflow: hidden;
}
body.portal-open #dash-header,
body.portal-open main.container {
    display: none !important;
}

#portal-frame {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: 10000;
    border: none;
    background: white;
}
#portal-exit {
    display: none;
    position: fixed;
    bottom: 40px; /* Moved back to bottom */
    left: 40px;   /* Moved back to left */
    z-index: 10001;
    background: var(--primary-color);
    color: #ffffff !important;
    border: none;
    padding: 1rem 2rem; /* Increased padding to fit text perfectly */
    border-radius: 50px;
    font-weight: 700;

    font-size: 0.95rem;
    cursor: pointer;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    white-space: nowrap; /* Ensures text never wraps or overflows */
    width: fit-content;
}

#portal-exit:hover {
    background: #00428a;
    transform: scale(1.05) translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 89, 179, 0.6);
}

#portal-exit svg {
    color: #ffffff !important;
    width: 20px;
    height: 20px;
}
/* SLOTS GRID RESPONSIVENESS */
@media (max-width: 600px) {
    #slots-grid {
        grid-template-columns: 1fr !important;
    }
}

#portal-exit:hover { transform: translateY(-3px); background: var(--brand-blue); }

/* MODALS */
.modal-overlay {
    position: fixed;
    top:0; left:0; width:100%; height:100%;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 5000;
}
.modal-card {
    width: 450px;
    max-width: 95%;
}

@media (max-width: 1100px) {
    .admin-layout {
        grid-template-columns: 1fr;
    }
}

/* SKELETAL LOADER */
.skeleton {
    background: linear-gradient(90deg, var(--input-bg) 25%, var(--border-color) 50%, var(--input-bg) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
}
@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.skeleton-text { height: 1rem; width: 100%; margin-bottom: 0.5rem; }
.skeleton-title { height: 1.5rem; width: 50%; margin-bottom: 1rem; }
.skeleton-btn { height: 3rem; width: 100%; border-radius: 8px; }

/* TOOLS HUB GRID - STRICTOR ENFORCEMENT */
#services-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 2.5rem;
    width: 100%;
    margin-top: 2rem;
    justify-items: center; /* Center each card in its 1/4th slot */
}

@media (max-width: 1100px) {
    #services-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 800px) {
    #services-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important; /* Tighter gap for better fit */
    }
    #ready-view {
        align-items: center !important;
        text-align: center !important;
    }
}

#ready-view {
    display: none;
    width: 100%;
    text-align: left;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    min-height: 50vh;
}






.tool-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 4px;
    background: var(--primary-color);
    opacity: 0;
    transition: opacity 0.3s;
}

.tool-card:hover {
    transform: translateY(-8px);
    border-color: var(--primary-color);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

.tool-card:hover::before {
    opacity: 1;
}

.tool-logo-container {
    width: 80px;
    height: 80px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--input-bg);
    border-radius: 16px;
    padding: 12px;
}

.tool-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.tool-status-badge {
    font-size: 0.75rem;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: 50px;
    text-transform: uppercase;
    margin-bottom: 1rem;
    letter-spacing: 0.05rem;
}

.status-active { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.status-locked { background: rgba(239, 68, 68, 0.1); color: #f87171; }
.status-coming { background: var(--input-bg); color: var(--text-secondary); }

.tool-card h3 {
    font-size: 1.4rem;
    margin-bottom: 0.8rem;
    font-weight: 700;
}

.tool-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 2rem;
    flex-grow: 1;
}

.tool-action-btn {
    width: 100%;
    padding: 1rem;
    border-radius: 12px;
    font-size: 1rem;
    background: var(--primary-color);
}

.tool-card.locked {
    opacity: 0.7;
    filter: grayscale(0.5);
    cursor: not-allowed;
}

.tool-card.locked:hover {
    transform: none;
    border-color: var(--border-color);
}

.service-wrapper {
    display: flex;
    justify-content: center;
    width: 100%;
    min-width: 0; /* Prevent grid blowout */
}


/* LOGO-CENTRIC SERVICE CARD */

.service-logo-card {
    position: relative;
    width: 100%; /* Fill the grid column */
    max-width: 280px;
    height: 70px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 16px;
    padding: 10px 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible; /* Allow pulse to expand beyond card */
}



.service-logo-card:hover {
    background: var(--card-bg);
    border-color: var(--brand-blue);
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 89, 179, 0.15);
}

.logo-composite {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    white-space: nowrap;
    flex-wrap: nowrap;
}


.logo-icon {
    height: 42px;
    width: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}




.logo-text {
    height: auto;
    width: auto;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-shrink: 1;
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Ensure dynamic SVGs take up all available height and auto-width */
.logo-icon svg {
    height: 100%;
    width: 100%;
    display: block;
}

/* Color inheritance for text fallbacks */
.logo-text.themed-logo {
    color: var(--text-primary);
    transition: color 0.3s;
}

[data-theme="dark"] .logo-text.themed-logo {
    color: white;
}

/* 
   Logo Visibility Rectification (Final):
   StealthWriter logos now use 'currentColor' in the SVG source.
   They naturally inherit the theme's text color.
*/
.invert-dark {
    color: var(--text-primary);
    transition: color 0.3s ease;
}

[data-theme="dark"] .invert-dark {
    color: white !important;
}

[data-theme="light"] .invert-dark {
    color: var(--brand-blue) !important;
}



/* Main header logo inverter for Dark Mode */
[data-theme="dark"] .logo {
    filter: invert(1) brightness(2) drop-shadow(0 0 10px rgba(255, 255, 255, 0.2)) !important;
    color: white !important;
}


.logo-icon.themed-logo {
    filter: none;
}





.status-overlay {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 10px #10b981, 0 0 20px rgba(16, 185, 129, 0.4);
    z-index: 100;
    pointer-events: none;
}

.status-overlay::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #10b981;
    border-radius: 50%;
    animation: status-pulse 2s infinite;
}

@keyframes status-pulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(3); opacity: 0; }
}



@media (max-width: 600px) {
    .service-logo-card {
        padding: 8px 12px;
        height: 60px;
        max-width: 100%;
    }
    .logo-composite {
        gap: 10px;
        width: 100%;
        overflow: hidden;
    }
    .logo-icon {
        height: 32px;
        width: 32px;
    }
    .logo-text {
        font-size: 1rem;
        max-width: 100%;
    }
    .status-overlay {
        top: 4px;
        right: 4px;
        width: 6px;
        height: 6px;
    }

    #portal-exit {
        bottom: 20px;
        left: 20px;
        padding: 0.6rem 1.2rem;
        font-size: 0.8rem;
        gap: 8px;
    }
    
    /* MOBILE AWAITING SCREEN POLISH */
    #no-access-view {
        padding: 2rem 1.5rem !important;
        text-align: center !important;
    }
    #no-access-view div:first-child {
        font-size: 2.5rem !important;
        margin-bottom: 1.5rem !important;
    }
    #no-access-view h2 {
        font-size: 1.5rem !important;
        margin-bottom: 0.8rem !important;
    }
    #no-access-view p {
        font-size: 0.95rem !important;
        line-height: 1.5;
        margin: 0 auto !important;
    }
}

/* FULLSCREEN TOOL */
#tool-frame {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: 9999;
    border: none;
    background: white;
}
#back-button {
    position: fixed;
    bottom: 20px; left: 20px;
    z-index: 10000;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 12px 20px;
    border-radius: 30px;
    display: none;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s;
}
#back-button:hover { transform: translateY(-2px); }

/* ALERTS */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: none;
}
.alert-error { background: rgba(239, 68, 68, 0.1); border: 1px solid #ef4444; color: #fca5a5; }
.alert-success { background: rgba(16, 185, 129, 0.1); border: 1px solid #10b981; color: #6ee7b7; }
