/* Theme Variables - Improved Contrast */
:root {
    /* Primary Colors */
    --primary-color: #005858;
    --primary-dark: #004040;
    --primary-light: #1a6e6e;
    --primary-bg-light: #e6f3f3;
    --primary-bg-dark: #0d2b2b;
    
    /* Secondary Colors */
    --secondary-color: #ff6b35;
    --secondary-dark: #e55a2b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    
    /* Light Mode Backgrounds - Better contrast */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #f1f3f5;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #f8f9fa;
    
    /* Light Mode Text - Darker for better readability */
    --text-primary: #1a1a2e;
    --text-secondary: #2d2d3f;
    --text-muted: #4a5568;
    --text-light: #6b7280;
    --text-white: #ffffff;
    
    /* Light Mode Borders */
    --border-light: #e2e8f0;
    --border-medium: #cbd5e1;
    --border-dark: #94a3b8;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Dark Mode Variables - Lighter text for better readability */
[data-theme="dark"] {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-tertiary: #0f3460;
    --bg-sidebar: #16213e;
    --bg-card: #1e1e3a;
    --bg-hover: #2a2a4a;
    
    --text-primary: #f3f4f6;
    --text-secondary: #e5e7eb;
    --text-muted: #cbd5e1;
    --text-light: #9ca3af;
    --text-white: #ffffff;
    
    --border-light: #374151;
    --border-medium: #4b5563;
    --border-dark: #6b7280;
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: background-color var(--transition-normal), color var(--transition-normal);
    line-height: 1.5;
}

/* Typography - Enhanced readability */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.text-muted {
    color: var(--text-muted);
}

.text-light {
    color: var(--text-light);
}

/* Link Styles */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

[data-theme="dark"] a {
    color: var(--primary-light);
}

/* Card Styles - Better contrast */
.card {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-light);
    transition: all var(--transition-normal);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-primary);
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-light);
    background: var(--bg-secondary);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all var(--transition-fast);
    cursor: pointer;
    border: none;
    font-size: 0.875rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.btn-secondary:hover {
    background: var(--border-light);
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border-light);
    background: var(--bg-card);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 1rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.875rem;
    border-bottom: 2px solid var(--border-light);
}

td {
    padding: 0.875rem 1rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
}

tr:hover td {
    background: var(--bg-hover);
}

/* Form Inputs - Better visibility */
input, select, textarea {
    background: var(--bg-primary);
    border: 1px solid var(--border-medium);
    color: var(--text-primary);
    padding: 0.625rem 0.875rem;
    border-radius: 8px;
    width: 100%;
    transition: all var(--transition-fast);
    font-size: 0.875rem;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 88, 88, 0.1);
}

input::placeholder, textarea::placeholder {
    color: var(--text-light);
}

label {
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.375rem;
    display: block;
    font-size: 0.875rem;
}

/* Status Badges - Readable */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.25;
}

.status-approved {
    background: #d1fae5;
    color: #065f46;
}

[data-theme="dark"] .status-approved {
    background: #064e3b;
    color: #a7f3d0;
}

.status-pending {
    background: #fed7aa;
    color: #92400e;
}

[data-theme="dark"] .status-pending {
    background: #78350f;
    color: #fed7aa;
}

.status-rejected {
    background: #fee2e2;
    color: #991b1b;
}

[data-theme="dark"] .status-rejected {
    background: #7f1d1d;
    color: #fecaca;
}

.status-under_review {
    background: #dbeafe;
    color: #1e40af;
}

[data-theme="dark"] .status-under_review {
    background: #1e3a8a;
    color: #bfdbfe;
}

.status-need_improvement {
    background: #e9d5ff;
    color: #5b21b6;
}

[data-theme="dark"] .status-need_improvement {
    background: #4c1d95;
    color: #e9d5ff;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-light);
    transition: all var(--transition-normal);
    z-index: 100;
    overflow-y: auto;
}

.sidebar.collapsed {
    width: 80px;
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .logo-subtitle,
.sidebar.collapsed .nav-label {
    display: none;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-fast);
    border-radius: 10px;
    margin: 4px 12px;
    font-weight: 500;
}

.nav-item:hover {
    background: var(--primary-bg-light);
    color: var(--primary-color);
    transform: translateX(5px);
}

.nav-item.active {
    background: var(--primary-color);
    color: white;
}

.nav-item i {
    width: 20px;
    font-size: 18px;
}

/* Top Navbar */
.top-navbar {
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
    padding: 12px 24px;
    z-index: 99;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
}

/* Main Content */
.main-content {
    margin-left: 260px;
    transition: margin-left var(--transition-normal);
    min-height: 100vh;
}

.sidebar.collapsed ~ .main-content {
    margin-left: 80px;
}

/* Stat Cards */
.stat-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    transition: all var(--transition-normal);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-title {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.stat-value {
    color: var(--text-primary);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-change {
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stat-change.positive {
    color: var(--success);
}

.stat-change.negative {
    color: var(--danger);
}

/* Footer */
.footer {
    background: var(--bg-primary);
    border-top: 1px solid var(--border-light);
    padding: 40px 0 20px;
    margin-top: 60px;
}

/* Theme Toggle Button */
.theme-toggle {
    position: relative;
    width: 48px;
    height: 24px;
    background: var(--bg-tertiary);
    border-radius: 50px;
    cursor: pointer;
    transition: all var(--transition-normal);
    border: 1px solid var(--border-light);
    outline: none;
}

.theme-toggle::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    top: 1px;
    left: 2px;
    transition: transform var(--transition-normal);
}

.theme-toggle.dark::before {
    transform: translateX(24px);
}

.theme-toggle .sun-icon,
.theme-toggle .moon-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    z-index: 1;
}

.theme-toggle .sun-icon {
    left: 7px;
    color: white;
}

.theme-toggle .moon-icon {
    right: 7px;
    color: white;
}

/* Logo Styles */
.logo-container {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    transition: transform var(--transition-normal);
}

.logo-container:hover .logo-icon {
    transform: scale(1.05) rotate(5deg);
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.logo-text span {
    color: var(--primary-color);
}

.logo-subtitle {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 1px;
}

/* Notification Badge */
.notification-badge {
    position: relative;
    cursor: pointer;
}

.notification-badge .badge-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 1.5s infinite;
    font-weight: 600;
}

/* User Dropdown */
.user-dropdown {
    position: relative;
}

.user-dropdown .dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    min-width: 240px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-normal);
    z-index: 1000;
    border: 1px solid var(--border-light);
}

.user-dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu a {
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.dropdown-menu a:hover {
    background: var(--bg-hover);
    color: var(--primary-color);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease forwards;
}

.animate-slide-left {
    animation: slideInLeft 0.5s ease forwards;
}

.animate-slide-right {
    animation: slideInRight 0.5s ease forwards;
}

/* Progress Bar */
.progress-bar {
    transition: width 0.5s ease-in-out;
}

/* Welcome Banner */
.welcome-banner {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    position: relative;
    overflow: hidden;
    border-radius: 16px;
}

.welcome-banner h2,
.welcome-banner p,
.welcome-banner span {
    color: white !important;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .top-navbar {
        padding: 12px 16px;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Utility Classes */
.text-primary {
    color: var(--primary-color) !important;
}

.bg-primary {
    background: var(--primary-color) !important;
}

.border-primary {
    border-color: var(--primary-color) !important;
}

.gradient-bg {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
}

/* Glass Effect */
.glass-effect {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .glass-effect {
    background: rgba(0, 0, 0, 0.3);
}