:root {
    --primary-color: #667eea;
    --primary-dark: #5568d3;
    --secondary-color: #764ba2;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    --dark-color: #1f2937;
    --light-color: #f9fafb;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Light Theme (Default) */
[data-theme="light"] {
    --bg-color: #ffffff;
    --text-color: #1a1a1a;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
    --navbar-bg: #ffffff;
    --footer-bg: #ffffff;
    --hover-bg: #f3f4f6;
    --input-bg: #ffffff;
    --table-header-bg: #ffffff;
    --table-hover-bg: #f9fafb;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #e5e7eb;
    --card-bg: #2d2d2d;
    --border-color: #404040;
    --navbar-bg: #1a1a1a;
    --footer-bg: #1a1a1a;
    --hover-bg: #2d2d2d;
    --input-bg: #2d2d2d;
    --table-header-bg: #2d2d2d;
    --table-hover-bg: #353535;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
    height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-color);
    min-height: 100vh;
    height: 100%;
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.wrapper {
    flex: 1 0 auto;
    min-height: 0;
}

/* Modern Navbar */
.navbar {
    background: var(--navbar-bg) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    transition: transform 0.3s ease;
    color: var(--text-color) !important;
}

.navbar-brand:hover {
    transform: scale(1.05);
}

.navbar-brand img {
    filter: none;
    transition: transform 0.3s ease;
}

.navbar-brand:hover img {
    transform: rotate(5deg);
}

.nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: 8px;
    transition: all 0.3s ease;
    margin: 0 0.25rem;
    color: var(--text-color) !important;
}

.nav-link:hover {
    background: var(--hover-bg);
    transform: translateY(-2px);
    color: var(--text-color) !important;
}

.nav-link.active {
    background: var(--hover-bg);
    font-weight: 600;
    color: var(--text-color) !important;
}

.theme-toggle {
    border: none;
    background: transparent;
    padding: 0.5rem 1rem !important;
    font-size: 1.2rem;
    color: var(--text-color) !important;
}

.theme-toggle:hover {
    background: var(--hover-bg);
    transform: rotate(15deg);
}

/* Modern Cards */
.card {
    border: none;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    overflow: hidden;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
}

.card:hover {
    box-shadow: var(--shadow-xl);
    transform: translateY(-4px);
}

.card-header {
    background: var(--card-bg);
    color: var(--text-color);
    border: none;
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    font-size: 1.1rem;
}

.card-body {
    padding: 1.5rem;
}

/* Stat Cards */
.stat-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-color);
    height: 100%;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, transparent 0%, rgba(102, 126, 234, 0.3) 50%, transparent 100%);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.stat-card-primary {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%);
    border-left: 4px solid #667eea;
}

.stat-card-primary:hover {
    border-left-color: #764ba2;
}

.stat-card-warning {
    background: linear-gradient(135deg, #ffffff 0%, #fff7ed 100%);
    border-left: 4px solid #f59e0b;
}

.stat-card-warning:hover {
    border-left-color: #f97316;
}

.stat-card-info {
    background: linear-gradient(135deg, #ffffff 0%, #eff6ff 100%);
    border-left: 4px solid #3b82f6;
}

.stat-card-info:hover {
    border-left-color: #2563eb;
}

.stat-card-success {
    background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
    border-left: 4px solid #10b981;
}

.stat-card-success:hover {
    border-left-color: #059669;
}

.stat-card h5 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    letter-spacing: 0.3px;
}

.stat-card h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

/* Modern Buttons */
.btn {
    border-radius: 10px;
    padding: 0.625rem 1.25rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-primary {
    background: var(--text-color);
    color: var(--bg-color);
    border: 1px solid var(--text-color);
}

[data-theme="light"] .btn-primary {
    background: #1a1a1a;
    color: #ffffff;
    border: 1px solid #1a1a1a;
}

[data-theme="light"] .btn-primary:hover {
    background: #2d2d2d;
    border-color: #2d2d2d;
    color: #ffffff;
}

[data-theme="dark"] .btn-primary {
    background: #e5e7eb;
    color: #1a1a1a;
    border: 1px solid #e5e7eb;
}

[data-theme="dark"] .btn-primary:hover {
    background: #ffffff;
    border-color: #ffffff;
    color: #1a1a1a;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    border-radius: 8px;
}

/* Modern Tables */
.table {
    border-radius: 12px;
    overflow: hidden;
}

.table thead {
    background: var(--table-header-bg);
    color: var(--text-color);
    border-bottom: 2px solid var(--border-color);
}

.table thead th {
    border: none;
    padding: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.table tbody tr {
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:hover {
    background: var(--table-hover-bg);
    transform: scale(1.01);
    box-shadow: var(--shadow-sm);
}

.table tbody td {
    padding: 1rem;
    vertical-align: middle;
}

/* Badges */
.badge {
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Forms */
.form-control,
.form-select {
    border-radius: 10px;
    border: 2px solid var(--border-color);
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
    background: var(--input-bg);
    color: var(--text-color);
}

.form-control:focus,
.form-select:focus {
    border-color: #1a1a1a;
    box-shadow: 0 0 0 0.2rem rgba(26, 26, 26, 0.1);
    outline: none;
}

.form-label {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

/* Alerts */
.alert {
    border-radius: 12px;
    border: none;
    box-shadow: var(--shadow-md);
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
}

.alert-success {
    background: var(--card-bg);
    color: #065f46;
    border: 1px solid #a7f3d0;
}

[data-theme="dark"] .alert-success {
    color: #a7f3d0;
}

.alert-danger {
    background: var(--card-bg);
    color: #991b1b;
    border: 1px solid #fecaca;
}

[data-theme="dark"] .alert-danger {
    color: #fecaca;
}

.alert-info {
    background: var(--card-bg);
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

[data-theme="dark"] .alert-info {
    color: #bfdbfe;
}

/* Page Headers */
.page-header {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border-color);
}

.page-header h2 {
    margin: 0;
    font-weight: 700;
    color: var(--text-color);
    font-size: 1.75rem;
}

/* Footer */
.footer {
    background: var(--footer-bg);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    width: 100%;
    flex-shrink: 0;
    margin-top: auto;
    position: relative;
    z-index: 0;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Loading Spinner */
.spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3em;
}

/* Dropdown */
.dropdown-menu {
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
    margin-top: 0.5rem;
    background: var(--card-bg);
    color: var(--text-color);
}

.dropdown-item {
    border-radius: 8px;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
    color: var(--text-color);
}

.dropdown-item:hover {
    background: var(--hover-bg);
    transform: translateX(4px);
    color: var(--text-color);
}

/* Container */
.container-fluid {
    padding: 1rem 0.5rem;
    max-width: 100%;
    margin: 0 auto;
    padding-bottom: 6rem;
}

/* Responsive */
@media (max-width: 768px) {
    .container-fluid {
        padding: 1rem;
    }
    
    .stat-card h2 {
        font-size: 2rem;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--light-color);
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Focus styles */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(26, 26, 26, 0.1);
}

/* Print styles */
@media print {
    .navbar,
    .btn,
    .footer {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Text muted color for themes */
[data-theme="light"] .text-muted {
    color: #6b7280 !important;
}

[data-theme="dark"] .text-muted {
    color: #9ca3af !important;
}
