:root {
    /* THEME UPDATE: Green colors extracted from NFIA Logo */
    --primary-color: #008753;   /* Vibrant Nigeria Green */
    --secondary-color: #004d2e; /* Darker Green for gradient depth */
    --sidebar-width: 260px;     /* Slightly wider for better spacing */
    --header-height: 60px;
    --transition-speed: 0.3s;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fc;
    overflow-x: hidden;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    /* Updated Gradient to Green Theme */
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    transition: all var(--transition-speed) ease;
    z-index: 1000;
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-header {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header h3 {
    color: white;
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Logo Image Styling */
.sidebar-logo {
    width: 40px;
    height: 40px;
    object-fit: cover;
    background-color: white;
    border-radius: 8px; /* Rounded corners like an app icon */
    padding: 2px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-link {
    color: rgba(255, 255, 255, 0.85); /* Increased contrast */
    padding: 0.8rem 1rem;
    margin: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    text-decoration: none;
    font-size: 0.95rem;
}

.nav-link:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.15);
    transform: translateX(3px);
}

.nav-link.active {
    color: var(--primary-color); /* Green text for active state */
    background-color: white;     /* White background for active state */
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-link i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.nav-link .badge {
    margin-left: auto;
    font-size: 0.7rem;
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition-speed) ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content.expanded {
    margin-left: 0;
}

/* Header Styles */
.main-header {
    background: white;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.05);
    height: var(--header-height);
    position: sticky;
    top: 0;
    z-index: 900; /* Lower than sidebar but higher than content */
}

.header-content {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--primary-color); /* Match toggle to theme */
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    transition: all 0.2s;
}

.user-avatar {
    width: 35px;
    height: 35px;
    /* Update avatar to match green theme */
    background: linear-gradient(45deg, var(--primary-color), #20c997);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background-color: #e74a3b;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

/* Content Area */
.content-wrapper {
    flex: 1;
    padding: 1.5rem;
    background-color: #f8f9fc;
}

/* Footer Styles */
.main-footer {
    background: white;
    border-top: 1px solid #e3e6f0;
    padding: 1rem 1.5rem;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition-speed) ease;
}

.main-footer.expanded {
    margin-left: 0;
}

/* Responsive Logic */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content,
    .main-footer {
        margin-left: 0;
        width: 100%;
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        backdrop-filter: blur(2px); /* Nice blur effect on mobile */
    }
    
    .sidebar-overlay.show {
        display: block;
    }
    
    /* Fix header padding on mobile */
    .header-content {
        padding: 0 1rem;
    }
}

/* Utility overrides for theme consistency */
.text-primary { color: var(--primary-color) !important; }
.bg-primary { background-color: var(--primary-color) !important; }
.btn-primary { 
    background-color: var(--primary-color); 
    border-color: var(--primary-color); 
}
.btn-primary:hover { 
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--secondary-color); }


/* =========================================
   AUTHENTICATION PAGES (Login / Register)
   ========================================= */

/* Body Background for Auth Pages */
body.auth-page {
    background: 
        linear-gradient(rgba(0, 77, 46, 0.85), rgba(0, 135, 83, 0.75)),
        url('https://images.unsplash.com/photo-1599831932375-7b1981502422?q=80&w=1920&auto=format&fit=crop');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding-bottom: 40px;
}

/* Common Card Styles */
.auth-card { 
    border-radius: 16px; 
    /* Glassmorphism feel */
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.3); 
    border: none;
    border-top: 5px solid var(--primary-color);
}

.auth-brand-logo {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 16px;
    margin-bottom: 1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    border: 3px solid rgba(255,255,255,0.3);
}

.text-theme {
    color: var(--primary-color) !important;
}

/* Login Specifics */
.login-container { 
    width: 100%;
    max-width: 420px; 
    padding: 15px;
    animation: fadeInUp 0.5s ease-out;
}

.login-header h4 {
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Registration Specifics */
.registration-container {
    max-width: 750px;
    margin: 40px auto;
    width: 100%;
}

.registration-card-header {
    background-color: white;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    padding: 1.5rem;
    text-align: center;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
}

.reg-logo-small {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 10px;
    margin-right: 15px;
}

.section-title {
    color: var(--primary-color);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e9ecef;
    display: flex;
    align-items: center;
}

.section-title i {
    margin-right: 10px;
    background: rgba(0, 135, 83, 0.1);
    padding: 8px;
    border-radius: 50%;
    font-size: 1rem;
}

/* Form Controls Override for Auth */
.auth-form-control {
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #e1e1e1;
    background-color: #f8f9fa;
}

.auth-form-control:focus {
    background-color: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(0, 135, 83, 0.1);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.85);
    display: none;
    justify-content: center; align-items: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}
.loading-overlay.active { display: flex; }

/* Animations */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   UTILITIES & MEDIA QUERIES
   ========================================= */

.text-primary { color: var(--primary-color) !important; }
.bg-primary { background-color: var(--primary-color) !important; }
.btn-primary { 
    background-color: var(--primary-color); 
    border-color: var(--primary-color); 
    font-weight: 600;
}
.btn-primary:hover { 
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

/* Mobile Sidebar & Layout */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content,
    .main-footer {
        margin-left: 0;
        width: 100%;
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        backdrop-filter: blur(2px);
    }
    
    .sidebar-overlay.show {
        display: block;
    }
    
    .header-content {
        padding: 0 1rem;
    }
    
    /* Auth Mobile tweaks */
    .registration-container {
        margin: 20px 10px;
    }

    /* Responsive Table Transformation */
    .table-responsive-stack .table {
        border: 0;
    }
    
    .table-responsive-stack thead {
        display: none;
    }
    
    .table-responsive-stack tr {
        display: block;
        margin-bottom: 1.5rem;
        border: 1px solid #e3e6f0;
        border-radius: 0.5rem;
        background: #fff;
        box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    }
    
    .table-responsive-stack td {
        display: block;
        text-align: right;
        border-bottom: 1px solid #e3e6f0;
        position: relative;
        padding-left: 50% !important;
        min-height: 3rem;
        display: flex;
        align-items: center;
        justify-content: flex-end;
    }
    
    .table-responsive-stack td:before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 45%;
        padding-left: 1rem;
        font-weight: 700;
        text-align: left;
        color: var(--primary-color);
        text-transform: uppercase;
        font-size: 0.75rem;
        letter-spacing: 0.5px;
    }
    
    .table-responsive-stack td:last-child {
        border-bottom: 0;
    }
}