:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-color);
    color: var(--dark-color);
}

/* Layout */
.impersonate-warning {
    position: fixed;
    top: 0;
    left: 250px;
    right: 0;
    z-index: 999;
    margin: 0;
    border-radius: 0;
}

.sidebar {
    min-height: 100vh;
    background: var(--primary-gradient);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    width: 250px;
    overflow-y: auto;
    transition: all 0.3s;
    z-index: 1000;
}

.sidebar-logo {
    padding: 1.5rem;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo h4 {
    margin: 0;
    font-weight: 600;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li a {
    display: block;
    padding: 0.875rem 1.5rem;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: all 0.3s;
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active {
    background: rgba(255,255,255,0.1);
    color: white;
    padding-left: 2rem;
}

.sidebar-menu li a i {
    margin-right: 0.5rem;
    width: 20px;
}

.main-content {
    margin-left: 250px;
    padding: 0;
    transition: all 0.3s;
}

.top-navbar {
    background: white;
    padding: 1rem 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.content-area {
    padding: 2rem;
}

.stats-card {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.hover-card {
    transition: transform 0.3s, box-shadow 0.3s;
}

.hover-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15) !important;
}

.stats-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn {
    border-radius: 8px;
}

.table {
    background: white;
}

.badge {
    padding: 0.35em 0.65em;
    font-weight: 500;
}

/* Table Sorting */
.table thead th.sortable-header {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 1.5rem;
    transition: color 0.2s ease;
}

.table thead th.sortable-header:focus {
    outline: none;
    color: var(--primary-color);
}

.sort-indicator {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    opacity: 0.35;
    transition: opacity 0.2s ease;
}

.sort-indicator::before {
    content: '\2195';
}

.sortable-header.sorted-asc .sort-indicator::before {
    content: '\2191';
}

.sortable-header.sorted-desc .sort-indicator::before {
    content: '\2193';
}

.sortable-header.sorted-asc .sort-indicator,
.sortable-header.sorted-desc .sort-indicator {
    opacity: 1;
}

/* Landing & Public Pages */
.navbar-custom {
    background: var(--primary-gradient);
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.navbar-custom.light {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
}

.navbar-custom .navbar-brand {
    color: white !important;
}

.navbar-custom.light .navbar-brand {
    color: var(--dark-color) !important;
}

.hero-section {
    background: var(--primary-gradient);
    color: white;
    padding: 4rem 0;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="rgba(255,255,255,0.1)" d="M0,96L48,112C96,128,192,160,288,160C384,160,480,128,576,112C672,96,768,96,864,112C960,128,1056,160,1152,160C1248,160,1344,128,1392,112L1440,96L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>') center bottom no-repeat;
    background-size: cover;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.stat-card {
    border-radius: 15px;
    padding: 2rem;
    box-shadow: var(--card-shadow);
}

.stat-icon {
    height: 60px;
    width: 60px;
    border-radius: 12px;
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: #6c757d;
    font-size: 0.95rem;
}

.unit-card,
.stats-box,
.feature-card {
    background: white;
    border-radius: 15px;
    box-shadow: var(--card-shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

.unit-card:hover,
.stats-box:hover,
.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.unit-image {
    height: 200px;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3rem;
}

.unit-body {
    padding: 1.5rem;
}

.unit-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.unit-stats {
    display: flex;
    justify-content: space-between;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
    margin-top: 1rem;
}

.unit-stat-item {
    text-align: center;
}

.unit-stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #667eea;
}

.unit-stat-label {
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

.cta-section,
.features-section {
    background: #f8f9fa;
    padding: 80px 0;
}

.cta-box {
    background: var(--primary-gradient);
    border-radius: 20px;
    padding: 3rem;
    color: white;
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.4);
}

.footer {
    background: #1a1a2e;
    color: white;
    padding: 60px 0;
}

.footer-link {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
}

.footer-link:hover {
    color: white;
}

/* Login */
body.login-page {
    background: var(--primary-gradient);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 450px;
    padding: 15px;
}

.login-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    overflow: hidden;
}

.login-header {
    background: var(--primary-gradient);
    color: white;
    padding: 2rem;
    text-align: center;
}

.login-header h3 {
    margin: 0;
    font-weight: 600;
}

.login-header p {
    margin: 0.5rem 0 0;
    opacity: 0.9;
}

.login-body {
    padding: 2rem;
}

.form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.btn-login {
    background: var(--primary-gradient);
    border: none;
    color: white;
    padding: 0.75rem;
    font-weight: 600;
    transition: transform 0.2s;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
    color: white;
}

.form-floating {
    margin-bottom: 1rem;
}

.divider {
    text-align: center;
    margin: 1.5rem 0;
    position: relative;
}

.divider:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #dee2e6;
}

.divider span {
    background: white;
    padding: 0 1rem;
    position: relative;
    color: #6c757d;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        margin-left: -250px;
    }

    .sidebar.active {
        margin-left: 0;
    }

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

/* Dark mode */
[data-bs-theme="dark"] {
    --light-color: #212529;
    --dark-color: #f8f9fa;
}

[data-bs-theme="dark"] body {
    background-color: #1a1d20;
    color: #e9ecef;
}

[data-bs-theme="dark"] .top-navbar,
[data-bs-theme="dark"] .stats-card,
[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .login-card {
    background-color: #2b3035;
    color: #e9ecef;
}

[data-bs-theme="dark"] .table {
    background-color: #2b3035;
    color: #e9ecef;
}

[data-bs-theme="dark"] .divider span {
    background: #2b3035;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}
