:root {
    --red: #DC143C;
    --dark-red: #B71C1C;
    --blue: #002868;
    --dark-blue: #001845;
    --white: #FFFFFF;
    --off-white: #F8F9FA;
    --light-gray: #E9ECEF;
    --gray: #6C757D;
    --dark-gray: #343A40;
    --purple: #6B46C1;
    --green: #10B981;
    --sidebar-width: 260px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--dark-gray);
}

/* ========== LOGIN PAGE ========== */
.login-body {
    background: linear-gradient(135deg, var(--blue) 0%, var(--dark-blue) 50%, var(--red) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, var(--blue) 0%, var(--dark-blue) 100%);
    color: var(--white);
    padding: 2.5rem 2rem;
    text-align: center;
}

.login-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.login-header p {
    opacity: 0.9;
    font-size: 1.1rem;
}

.login-form {
    padding: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark-gray);
}

.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--light-gray);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 40, 104, 0.1);
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 400;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.error-message {
    background-color: #FEE;
    color: var(--dark-red);
    padding: 0.875rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid var(--red);
    font-size: 0.95rem;
}

.btn-login {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--red) 0%, var(--dark-red) 100%);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 20, 60, 0.4);
}

.btn-login:active {
    transform: translateY(0);
}

.login-footer {
    padding: 1.5rem 2rem;
    background-color: var(--off-white);
    text-align: center;
}

.login-footer a {
    color: var(--blue);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.login-footer a:hover {
    color: var(--red);
}

/* ========== DASHBOARD ========== */
.dashboard-body {
    background-color: var(--off-white);
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--blue) 0%, var(--dark-blue) 100%);
    color: var(--white);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

.close-sidebar {
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    display: none;
    line-height: 1;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    color: var(--white);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-left-color: var(--red);
}

.nav-item.active {
    background-color: rgba(255, 255, 255, 0.15);
    border-left-color: var(--red);
    font-weight: 600;
}

.nav-icon {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

.nav-text {
    font-size: 0.95rem;
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 0;
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

.sidebar-overlay.active {
    display: block;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* Topbar */
.topbar {
    background-color: var(--white);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.hamburger {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.hamburger span {
    width: 24px;
    height: 3px;
    background-color: var(--blue);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.topbar-title h1 {
    font-size: 1.75rem;
    color: var(--blue);
    font-weight: 700;
}

.topbar-actions {
    margin-left: auto;
}

.admin-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.admin-name {
    font-weight: 600;
    color: var(--dark-gray);
}

.admin-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue) 0%, var(--red) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

/* Dashboard Content */
.dashboard-content {
    padding: 2rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
}

.stat-icon.blue {
    background: linear-gradient(135deg, var(--blue) 0%, #0039A6 100%);
}

.stat-icon.red {
    background: linear-gradient(135deg, var(--red) 0%, var(--dark-red) 100%);
}

.stat-icon.purple {
    background: linear-gradient(135deg, var(--purple) 0%, #553C9A 100%);
}

.stat-icon.green {
    background: linear-gradient(135deg, var(--green) 0%, #059669 100%);
}

.stat-info h3 {
    font-size: 0.9rem;
    color: var(--gray);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.stat-number {
    font-size: 2rem;
    color: var(--blue);
    font-weight: 700;
}

/* Sections */
.section {
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1.5rem;
    color: var(--blue);
    margin-bottom: 1.5rem;
    font-weight: 700;
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.action-btn {
    background: var(--white);
    border: 2px solid var(--light-gray);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark-gray);
}

.action-btn:hover {
    border-color: var(--blue);
    background: linear-gradient(135deg, var(--blue) 0%, var(--dark-blue) 100%);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 40, 104, 0.2);
}

.action-icon {
    font-size: 2rem;
}

/* Activity Card */
.activity-card {
    background: var(--white);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.empty-state {
    text-align: center;
    color: var(--gray);
    padding: 2rem;
    font-style: italic;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .close-sidebar {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .hamburger {
        display: flex;
    }
    
    .topbar {
        padding: 1rem;
    }
    
    .topbar-title h1 {
        font-size: 1.25rem;
    }
    
    .admin-name {
        display: none;
    }
    
    .dashboard-content {
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .quick-actions {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        flex-direction: column;
        text-align: center;
    }
}

/* Desktop - sidebar always visible */
@media (min-width: 769px) {
    .sidebar.active {
        transform: translateX(0);
    }
}

/* ========== COMMON COMPONENTS ========== */
.container {
    display: flex;
    min-height: 100vh;
}

.page-header {
    background: var(--white);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h2 {
    font-size: 1.875rem;
    color: var(--blue);
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.page-header p {
    color: var(--gray);
    font-size: 1rem;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.card {
    background: var(--white);
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin: 0 2rem 2rem 2rem;
}

/* ========== ALERTS ========== */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin: 0 2rem 1.5rem 2rem;
    border-left: 4px solid;
    font-size: 0.95rem;
    line-height: 1.5;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border-left-color: var(--green);
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border-left-color: var(--red);
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border-left-color: #ffc107;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-left-color: #17a2b8;
}

/* ========== BUTTONS ========== */
.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-family: inherit;
}

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.875rem;
}

.btn-primary {
    background: var(--blue);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--dark-blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 40, 104, 0.3);
}

.btn-success {
    background: var(--green);
    color: var(--white);
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-danger {
    background: var(--red);
    color: var(--white);
}

.btn-danger:hover {
    background: var(--dark-red);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 20, 60, 0.3);
}

.btn-secondary {
    background: var(--gray);
    color: var(--white);
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background: #e0a800;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========== DATA TABLE ========== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.data-table thead {
    background: linear-gradient(135deg, var(--blue) 0%, var(--dark-blue) 100%);
    color: var(--white);
}

.data-table th {
    padding: 1rem 1.5rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--light-gray);
}

.data-table tbody tr {
    transition: background-color 0.2s ease;
}

.data-table tbody tr:hover {
    background-color: var(--off-white);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ========== MODAL ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    background: linear-gradient(135deg, var(--blue) 0%, var(--dark-blue) 100%);
    color: var(--white);
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.close-modal {
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ========== FORMS ========== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark-gray);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="tel"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--light-gray);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: inherit;
    color: var(--dark-gray);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 40, 104, 0.1);
}

.form-group input:disabled,
.form-group select:disabled,
.form-group textarea:disabled {
    background-color: var(--light-gray);
    cursor: not-allowed;
    opacity: 0.7;
}

.form-group input[readonly] {
    background-color: var(--light-gray);
    cursor: not-allowed;
}

.form-group small {
    display: block;
    margin-top: 0.375rem;
    color: var(--gray);
    font-size: 0.875rem;
    line-height: 1.4;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding: 1.5rem 2rem;
    background-color: var(--off-white);
    border-radius: 0 0 12px 12px;
}

.modal form {
    padding: 2rem;
}

/* ========== LOADING ========== */
.loading {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--gray);
}

.loading p {
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.loading p:before {
    content: "";
    width: 20px;
    height: 20px;
    border: 3px solid var(--light-gray);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== RESPONSIVE UPDATES ========== */
@media (max-width: 768px) {
    .page-header {
        padding: 1.5rem 1rem;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .page-header h2 {
        font-size: 1.5rem;
    }
    
    .header-actions {
        width: 100%;
        justify-content: stretch;
    }
    
    .header-actions .btn {
        flex: 1;
    }
    
    .card {
        margin: 0 1rem 1.5rem 1rem;
        border-radius: 8px;
    }
    
    .alert {
        margin: 0 1rem 1rem 1rem;
    }
    
    .data-table {
        font-size: 0.875rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.75rem 0.875rem;
    }
    
    .modal-content {
        margin: 0.5rem;
        max-height: 95vh;
    }
    
    .modal form {
        padding: 1.5rem;
    }
    
    .form-actions {
        padding: 1rem 1.5rem;
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
    }
}

/* ========== MAINTENANCE MODE STYLES ========== */
.maintenance-card {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.maintenance-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--light-gray);
}

.maintenance-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark-gray);
    margin-bottom: 0.25rem;
}

.maintenance-header p {
    font-size: 0.875rem;
    color: var(--gray);
}

#maintenanceStatusText {
    font-weight: 600;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 32px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 32px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 24px;
    width: 24px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--red);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(28px);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 1px var(--red);
}

/* Maintenance Options */
.maintenance-options {
    margin-top: 1rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark-gray);
    font-size: 0.875rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--light-gray);
    border-radius: 6px;
    font-size: 0.875rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 40, 104, 0.1);
}

textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

/* Alert Styles */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-top: 1rem;
    font-size: 0.875rem;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

#maintenanceAlert {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .maintenance-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .toggle-switch {
        margin-top: 1rem;
    }
}
