/* =========================================
   1. THEME VARIABLES (LIGHT & DARK MODE)
========================================= */
:root {
    /* Light Theme (Default) */
    --bg-body: #eef2f5;
    --bg-card: #ffffff;
    --text-main: #333333;
    --text-muted: #666666;
    
    --primary: #00509e;       /* N.E. Railway Blue */
    --primary-hover: #003366;
    --secondary: #800000;     /* Admin Dark Red */
    
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    
    --border-color: #dddddd;
    --shadow-sm: 0 2px 5px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.1);
}

[data-theme="dark"] {
    /* Dark Theme */
    --bg-body: #121212;
    --bg-card: #1e1e1e;
    --text-main: #e0e0e0;
    --text-muted: #a0a0a0;
    
    --primary: #4da3ff;       
    --primary-hover: #1a8cff;
    --secondary: #440000;     
    
    --success: #34c759;
    --danger: #ff3b30;
    --warning: #ffcc00;
    --info: #32ade6;
    
    --border-color: #333333;
    --shadow-sm: 0 2px 5px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.5);
}

/* =========================================
   2. GLOBAL RESETS & BODY
========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body { 
    background-color: var(--bg-body); 
    color: var(--text-main); 
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* =========================================
   3. RELATABLE COMPONENTS (CARDS & BUTTONS)
========================================= */
/* Cards */
.card {
    background: var(--bg-card);
    padding: 25px;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}
.card-primary { border-top: 4px solid var(--primary); }
.card-admin { border-top: 4px solid var(--secondary); }
.card-success { border-top: 4px solid var(--success); }
.card-danger { border-top: 4px solid var(--danger); }

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    text-decoration: none;
    text-align: center;
    transition: background-color 0.3s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }

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

.btn-secondary { background-color: var(--secondary); color: white; }
.btn-success { background-color: var(--success); color: white; }
.btn-danger { background-color: var(--danger); color: white; }
.btn-warning { background-color: var(--warning); color: black; }
.btn-muted { background-color: var(--text-muted); color: white; }

/* =========================================
   4. LAYOUT & NAVIGATION (CLEANED)
========================================= */
.navbar {
    background-color: var(--primary); /* Replaced hardcoded #003366 */
    color: white;
    padding: 15px 20px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
    min-height: 80vh;
}

.footer {
    text-align: center;
    padding: 15px;
    background-color: var(--bg-card); /* Replaced #e9ecef */
    color: var(--text-muted); /* Replaced #6c757d */
    font-size: 14px;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
}

/* Alerts */
.alert {
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
    text-align: center;
}
.alert.error {
    background-color: rgba(220, 53, 69, 0.1); /* Transparent Danger */
    color: var(--danger);
    border: 1px solid var(--danger);
}
.alert.success {
    background-color: rgba(40, 167, 69, 0.1); /* Transparent Success */
    color: var(--success);
    border: 1px solid var(--success);
}

/* =========================================
   5. FORM ELEMENTS & INPUTS
========================================= */
/* Forms */
.form-group { margin-bottom: 15px; }
.form-label { display: block; margin-bottom: 5px; font-weight: 600; }
.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-card);
    color: var(--text-main);
    transition: border-color 0.3s;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

/* Specific Wrapper for Login/Register */
.auth-card {
    max-width: 450px;
    margin: 40px auto;
}
.auth-footer-box {
    background: var(--bg-body);
    padding: 15px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

/* =========================================
   6. MODAL, TABLES
========================================= */
/* Modal Box */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); z-index: 1000; justify-content: center; align-items: center;
}
.modal-box {
    background: var(--bg-card); padding: 25px; border-radius: 8px; width: 90%; max-width: 1000px;
    box-shadow: var(--shadow-md); animation: fadeIn 0.3s ease-in-out;
    max-height: 90vh; overflow-y: auto; color: var(--text-main);
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid var(--border-color); padding-bottom: 10px; margin-bottom: 15px;
}
.close-modal { font-size: 24px; cursor: pointer; color: var(--text-muted); }
.close-modal:hover { color: var(--danger); }

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

/* Custom Table */
.table-custom { width: 100%; border-collapse: collapse; margin-top: 15px; font-size: 14px; text-align: center; }
.table-custom th, .table-custom td { border: 1px solid var(--border-color); padding: 8px; vertical-align: middle; }
.table-custom th { background-color: var(--bg-body); font-weight: 600; }
.table-responsive { overflow-x: auto; }


/* Dark Mode Date/Time Picker Fix */
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="month"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

/* =========================================
   7. Utilities
========================================= */

.w-100 { width: 100%; }
.text-center { text-align: center; }
.text-primary { color: var(--primary); }
.text-muted { color: var(--text-muted); }
.text-decoration-none { text-decoration: none; }
.fw-bold { font-weight: bold; }
.mb-4 { margin-bottom: 20px; }
.mt-3 { margin-top: 15px; }
.mb-2 { margin-bottom: 10px; }
.text-sm { font-size: 14px; }
.text-xs { font-size: 12px; }
.m-0 { margin: 0; }
.m-1 { margin: 5px; }
.m-2 { margin: 10px; }
.mtb-1 { margin-top: 5px; margin-bottom: 5px; }
.mtb-2 { margin-top: 10px; margin-bottom: 10px; }
.mlr-1 { margin-left: 5px; margin-right: 5px; }
.mlr-2 { margin-left: 10px; margin-right: 10px; }
hr.divider { margin: 20px 0; border: 0; border-top: 1px solid var(--border-color); }
.d-flex { display: flex; }
.justify-content-center { justify-content: center; }
.justify-content-end { justify-content: flex-end; }
.align-items-center { align-items: center; }
.gap-2 { gap: 10px; }
.gap-1 { gap: 5px; }
.p-1 { padding: 4px 8px; font-size: 14px; }
.max-w-700 { max-width: 700px; margin: 40px auto; }
.mb-1 { margin-bottom: 6px; }