/*
    =========================================================
    REACH VORTEX - MASTER FOUNDATION
    Global Styles: Sidebar, Topbar, Layout, & Scrollbars
    =========================================================
*/

body { 
    background-color: #f4f5f7; 
    margin: 0; 
    padding: 0; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
}

a { 
    color: #1e1e2f; 
    text-decoration: none; 
}

/* --- MODERN CUSTOM SCROLLBAR (Sleek 8px) --- */
::-webkit-scrollbar {
    width: 10px; /* Thinned out for a cleaner look */
}
::-webkit-scrollbar-track {
    background: #f4f5f7; 
    border-left: 1px solid #e2e8f0; 
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1; 
    border-radius: 10px; /* Matched to the new width */
    border: 2px solid #f4f5f7; /* Reduced border so the thumb remains visible */
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8; 
}

/* --- GLOBAL TOPBAR (Emerald Theme) --- */
.saas-topbar { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    background: linear-gradient(135deg, #10b981 0%, #059669 100%); /* Emerald Gradient */
    padding: 0 40px; 
    height: 70px; 
    border-bottom: none; /* Removed hard border for a cleaner blend */
    box-shadow: 0 2px 10px rgba(0,0,0,0.1); 
}

.brand-logo { 
    font-size: 22px; 
    font-weight: 700; 
    color: #ffffff; /* Swapped to white for fallback text */
    letter-spacing: -0.5px; 
}

.topbar-actions { 
    display: flex; 
    gap: 20px; 
    align-items: center; 
}

/* Ensure standard text links in the topbar are white */
.topbar-actions a:not(.logout-btn) {
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    transition: opacity 0.2s;
}
.topbar-actions a:not(.logout-btn):hover {
    opacity: 0.85;
}

/* Frosted Glass Logout Button */
.logout-btn { 
    background: rgba(255, 255, 255, 0.15) !important; 
    padding: 6px 12px; 
    border-radius: 4px; 
    border: 1px solid rgba(255, 255, 255, 0.3) !important; 
    color: #ffffff !important; 
    font-weight: 600; 
    font-size: 14px; 
    transition: all 0.2s; 
    box-shadow: none !important;
}
.logout-btn:hover { 
    background: rgba(255, 255, 255, 0.25) !important; 
    color: #ffffff !important; 
}

/* --- MODERN DARK SLATE SIDEBAR --- */
.saas-sidebar { 
    width: 200px; 
    height: 100vh; 
    background-color: #0f172a !important; 
    border-right: 1px solid #1e293b; 
    color: white; 
    position: fixed; 
    top: 0; 
    left: 0; 
    z-index: 999; 
    transition: width 0.3s ease; 
    padding-top: 15px; 
    box-sizing: border-box; 
}

.saas-sidebar .toggle-btn { 
    background: transparent; 
    border: none; 
    color: #64748b; 
    font-size: 20px; 
    cursor: pointer; 
    padding: 10px 25px; 
    width: 100%; 
    text-align: left; 
    transition: color 0.2s ease;
    margin-bottom: 15px;
}
.saas-sidebar .toggle-btn:hover { color: #f8fafc; }

.saas-sidebar .sidebar-menu { 
    list-style: none; 
    padding-right:8px; 
    margin: 0; 
}

.saas-sidebar .sidebar-menu li {
    margin-bottom: 4px;
}

.saas-sidebar .sidebar-menu a { 
    display: flex; 
    align-items: center; 
    padding: 12px 15px; 
    color: #94a3b8; 
    font-weight: 500;
    font-size: 14px;
    border-radius: 8px; 
    transition: all 0.2s ease; 
    white-space: nowrap; 
}

.saas-sidebar .sidebar-menu a:hover { 
    background-color: #1e293b; 
    color: #f8fafc; 
    transform: translateX(4px); 
}

/* Updated Active State: Left Border + Translucent Background */
.saas-sidebar .sidebar-menu li.active a { 
    background: rgba(16, 185, 129, 0.08) !important; 
    color: #10b981 !important; 
    border-left: 3px solid #10b981; 
    border-radius: 0 8px 8px 0; /* Keep right side rounded, flush on left */
    font-weight: 600;
}

/* Force the icon to match the emerald text */
.saas-sidebar .sidebar-menu li.active a .icon { 
    color: #10b981 !important; 
}

.saas-sidebar .icon { 
    font-size: 18px; 
    min-width: 35px; 
    text-align: center;
    margin-right: 8px;
}

/* Sidebar Collapsed State */
.saas-sidebar.collapsed { width: 80px; }
.saas-sidebar.collapsed .menu-text { display: none; }
.saas-sidebar.collapsed .toggle-btn { text-align: center; padding: 10px; }
.saas-sidebar.collapsed .sidebar-menu { padding: 0 10px; }
.saas-sidebar.collapsed .sidebar-menu a { justify-content: center; padding: 12px 0; }
.saas-sidebar.collapsed .icon { margin-right: 0; }
.saas-sidebar.collapsed .sidebar-menu a:hover { transform: translateY(-2px); }
.saas-sidebar.collapsed .sidebar-menu li.active a { border-radius: 8px; border-left: none; background: rgba(16, 185, 129, 0.15) !important; } /* Center highlight when collapsed */

/* --- MAIN CONTENT & LAYOUT STRUCTURE --- */
.main-content { 
    margin-left: 200px; 
    transition: margin-left 0.3s ease, width 0.3s ease; 
    width: calc(100% - 200px); 
    box-sizing: border-box; 
}
body.sidebar-is-collapsed .main-content { 
    margin-left: 80px; 
    width: calc(100% - 80px); 
}

.main-panel { 
    padding: 30px !important;  
    margin: 0 auto; 
}

/* --- THE "SIGN UP" BUTTON HIJACK (FIXED) --- */
.main-header-menu > .menu-item > a[href*="/register"] {
    background-color: #10b981 !important;
    color: #ffffff !important;
    padding: 12px 24px !important;
    border-radius: 8px !important;
    font-weight: 700 !important;
    box-shadow: 0 4px 10px -2px rgba(16, 185, 129, 0.4) !important;
    transition: all 0.2s ease !important;
    
    /* THE FIX FOR ASTRA'S STRETCHING */
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important; /* Overrides Astra's massive header line-height */
    height: max-content !important; /* Stops it from stretching */
    align-self: center !important; /* Keeps it vertically centered in the nav */
    margin-left: 12px !important;
}

/* Button Hover State */
.main-header-menu > .menu-item > a[href*="/register"]:hover {
    background-color: #047857 !important;
    box-shadow: 0 6px 15px -2px rgba(16, 185, 129, 0.5) !important;
    transform: translateY(-1px) !important;
    color: #ffffff !important;
}

/* =========================================================
   PURE CSS LOGO OVERRIDE (NO HTML CHANGES REQUIRED)
   =========================================================
*/
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@800;900&display=swap');

/* 1. Nuke the hardcoded image */
.brand-logo img {
    display: none !important;
}

/* 2. Prep the anchor tag to act as the text container */
.brand-logo a {
    display: flex;
    align-items: center;
    font-family: 'Montserrat', -apple-system, sans-serif;
    font-size: 24px;
    text-decoration: none;
    letter-spacing: -0.5px;
}

/* 3. Inject "REACH " (White, Heavy) */
.brand-logo a::before {
    content: "REACH\00a0"; /* \00a0 forces a non-breaking space */
    color: #ffffff;
    font-weight: 900;
}

/* 4. Inject "VORTEX" (Dark Navy, slightly less heavy) */
.brand-logo a::after {
    content: "VORTEX";
    color: #0f172a; /* Matches your sidebar navy */
    font-weight: 800;
}

/* --- SLEEK DARK NAVY LOGOUT BUTTON --- */
.saas-topbar .logout-btn { 
    background: #0f172a !important; /* Exact match to the sidebar */
    padding: 8px 18px !important; 
    border-radius: 6px !important; 
    border: none !important; 
    color: #ffffff !important; 
    font-weight: 700 !important; 
    font-size: 13px !important; 
    transition: all 0.2s ease !important; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
}

.saas-topbar .logout-btn:hover { 
    background: #1e293b !important; /* Slightly lighter navy for hover state */
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3) !important;
}

/* --- MOBILE RESPONSIVENESS (FIXED) --- */
@media (max-width: 768px) {
    /* Default Mobile State: Collapsed */
    .saas-sidebar { width: 80px; }
    .saas-sidebar .menu-text { display: none; }
    .saas-sidebar .toggle-btn { text-align: center; padding: 10px 0; }
    .saas-sidebar .sidebar-menu { padding: 0 10px; }
    .saas-sidebar .sidebar-menu a { justify-content: center; padding: 12px 0; }
    .saas-sidebar .icon { margin-right: 0; }
    .saas-sidebar.collapsed .sidebar-menu li.active a { border-radius: 8px; border-left: none; }
    
    .main-content { margin-left: 80px; width: calc(100% - 80px); }
    .saas-topbar { padding: 0 15px; }
    .brand-logo, .brand-logo a { font-size: 18px; }
    .main-panel { padding: 20px 10px !important; }

    /* NEW: Expanded Mobile State */
    /* When the sidebar is NOT collapsed, expand it to 200px */
    body.sidebar-is-open .saas-sidebar { width: 200px; }
    body.sidebar-is-open .saas-sidebar .menu-text { display: inline-block; }
    body.sidebar-is-open .saas-sidebar .toggle-btn { text-align: left; padding: 10px 25px; }
    body.sidebar-is-open .saas-sidebar .sidebar-menu a { justify-content: flex-start; padding: 12px 15px; }
    body.sidebar-is-open .saas-sidebar .icon { margin-right: 8px; }
}