/* =========================================
   1. GLOBAL & LAYOUT
   ========================================= */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    background-color: #091E80;
    color: #333;
    display: flex;
    height: 100vh;
}

/* Specific override for Login Page centering */
body.login-page {
    justify-content: center;
    align-items: center;
}

.main-content {
    flex-grow: 1; 
    padding: 20px; 
    overflow-y: auto; 
    scroll-behavior: smooth;
}

/* Override for Assign-Call specific flex layout */
.main-content.flex-col {
    display: flex; 
    flex-direction: column;
}

.header {
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 20px; 
    color: white;
}

.clock {
    font-size: 28px; 
    font-weight: bold; 
    font-family: monospace;
}

/* =========================================
   2. SIDEBAR NAVIGATION
   ========================================= */
.sidebar {
    width: 250px;
    background-color: #1e293b;
    color: white;
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0; 
}

.sidebar h2 { 
    margin-top: 0; 
    font-size: 20px; 
    border-bottom: 1px solid #475569; 
    padding-bottom: 10px; 
}

.nav-links { 
    display: flex; 
    flex-direction: column; 
    flex-grow: 1; 
}

.nav-btn {
    background: none; 
    border: none; 
    color: #cbd5e1; 
    text-align: left;
    padding: 12px 10px; 
    font-size: 16px; 
    cursor: pointer; 
    border-radius: 5px; 
    margin-bottom: 5px;
}

.nav-btn:hover { background-color: #334155; color: white; }
.nav-btn.active { background-color: #334155; color: white; border-left: 4px solid #2563eb; }

/* Dropdown Menu Styling */
.dropdown-btn {
    background: none; 
    border: none; 
    color: #cbd5e1; 
    text-align: left; 
    padding: 12px 10px; 
    font-size: 16px; 
    cursor: pointer; 
    border-radius: 5px; 
    margin-bottom: 5px; 
    text-decoration: none; 
    display: block; 
    width: 100%;
}

.dropdown-btn:hover { 
    background-color: #334155; 
    color: white; 
}

.dropdown-btn::after {
    content: '\25BC'; /* Down Arrow */
    float: right;
    font-size: 12px;
    margin-top: 3px;
}

.active-dropdown {
    background-color: #334155; 
    color: white;
}

.active-dropdown::after {
    content: '\25B2'; /* Up Arrow */
}

.dropdown-container {
    display: none;
    background-color: #0f172a;
    padding-left: 15px;
    border-radius: 5px;
    margin-bottom: 5px;
}

.dropdown-container .nav-btn {
    font-size: 14px;
    margin-bottom: 2px;
}

.logout-btn { color: #fca5a5; margin-top: auto; margin-bottom: 20px; }
.logout-btn:hover { background-color: #991b1b; color: white; }

.sidebar-footer {
    border-top: 1px solid #475569;
    padding-top: 15px;
    font-size: 12px;
    color: #94a3b8;
    text-align: center;
}

/* =========================================
   3. CARDS & CONTAINERS
   ========================================= */
.card {
    background: white; 
    border-radius: 8px; 
    padding: 25px; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.card h3 { 
    margin-top: 0; 
    color: #0f172a; 
    border-bottom: 2px solid #e2e8f0; 
    padding-bottom: 10px; 
    margin-bottom: 20px; 
    display: flex; 
    justify-content: space-between;
}

.login-card {
    background-color: white; padding: 40px; border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3); width: 100%; max-width: 350px; text-align: center;
}
.login-card h2 { margin-top: 0; color: #0f172a; margin-bottom: 5px; }
.login-card p { color: #64748b; font-size: 14px; margin-bottom: 25px; }

/* =========================================
   4. GRID SYSTEM OVERRIDES
   ========================================= */
.admin-grid-top { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 20px; align-items: start; }
.grid-assets { display: grid; grid-template-columns: 1fr 2.5fr; gap: 20px; }
.grid-dashboard { display: grid; grid-template-columns: 2.5fr 1fr; gap: 20px; }
.dispatch-container { display: grid; grid-template-columns: 300px 1fr 350px; gap: 20px; flex-grow: 1; }
.dispatch-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; }
.policy-layout { display: grid; grid-template-columns: 250px 1fr; gap: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 15px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 15px; }

.left-column { display: flex; flex-direction: column; gap: 20px; }
.flex-row { display: flex; gap: 10px; }
.full-width { grid-column: 1 / -1; margin-top: 10px; }

/* =========================================
   5. FORMS & INPUTS
   ========================================= */
.input-group, .form-group { 
    display: flex; 
    flex-direction: column; 
    margin-bottom: 15px; 
    text-align: left;
}

.input-group label, .form-group label { 
    font-size: 13px; 
    font-weight: bold; 
    color: #475569; 
    margin-bottom: 5px; 
}

/* Optional uppercase labels used in some dispatches */
.form-group.sm-label label { font-size: 11px; text-transform: uppercase; }

.input-group input, .input-group select, .input-group textarea,
.form-group input, .form-group select, .form-group textarea {
    padding: 10px; 
    font-size: 14px; 
    border: 1px solid #cbd5e1; 
    border-radius: 5px;
    font-family: inherit; 
    box-sizing: border-box; 
    width: 100%;
}

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

.input-group input:focus, .input-group select:focus, .input-group textarea:focus,
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; 
    border-color: #2563eb; 
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.section-divider {
    grid-column: 1 / -1;
    font-size: 14px; font-weight: bold; color: #2563eb;
    border-bottom: 1px dashed #cbd5e1; padding-bottom: 5px; margin-top: 10px; margin-bottom: 5px;
}

/* =========================================
   6. BUTTONS
   ========================================= */
.btn-primary { background-color: #2563eb; color: white; border: none; padding: 10px 15px; font-size: 14px; border-radius: 5px; cursor: pointer; font-weight: bold; }
.btn-primary:hover { background-color: #1d4ed8; }

.btn-success { background-color: #16a34a; margin-top: 15px; width: 100%; padding: 12px; font-size: 16px;}
.btn-success:hover { background-color: #15803d; }

.btn-danger { background-color: #fee2e2; color: #991b1b; padding: 5px 10px; border-radius: 4px; border: none; cursor: pointer; font-weight: bold; font-size: 12px;}
.btn-danger:hover { background-color: #fca5a5; }

.btn-login { width: 100%; background-color: #2563eb; color: white; border: none; padding: 12px; font-size: 16px; border-radius: 5px; cursor: pointer; font-weight: bold; margin-top: 10px; }
.btn-login:hover { background-color: #1d4ed8; }

.btn-submit { background-color: #2563eb; color: white; border: none; padding: 12px; border-radius: 5px; font-weight: bold; cursor: pointer; width: 100%; margin-top: 10px; }
.btn-submit:hover { background-color: #1d4ed8; }

.btn-assign { background-color: #f1f5f9; color: #1e293b; border: 1px solid #cbd5e1; padding: 5px 10px; border-radius: 4px; font-size: 11px; cursor: pointer; font-weight: bold; }
.btn-assign:hover { background-color: #e2e8f0; }

.btn-action { background-color: #2563eb; color: white; border: none; padding: 8px 15px; border-radius: 4px; cursor: pointer; font-weight: bold; font-size: 12px; text-decoration: none;}
.btn-view { background-color: #2563eb; color: white; border: none; padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 12px; }
.btn-view:hover { background-color: #1d4ed8; }

.btn-dl { background-color: #2563eb; color: white; border: none; padding: 8px 15px; border-radius: 5px; font-size: 13px; font-weight: bold; cursor: pointer;}
.btn-dl:hover { background-color: #1d4ed8; }

.btn-dispatch { background-color: #dc2626; color: white; border: none; padding: 18px; border-radius: 5px; font-weight: bold; cursor: pointer; width: 100%; font-size: 18px; box-shadow: 0 4px 0 #991b1b; transition: all 0.1s; }
.btn-dispatch.update-mode { background-color: #2563eb; box-shadow: 0 4px 0 #1e40af; }

.btn-update { background-color: #2563eb; color: white; border: none; padding: 12px; border-radius: 5px; font-weight: bold; cursor: pointer; margin-top: auto; }
.btn-add-unit { background-color: #1e293b; color: white; border: none; padding: 8px; border-radius: 5px; font-size: 12px; cursor: pointer; margin-top: 5px; }

/* =========================================
   7. TABLES & BADGES
   ========================================= */
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 14px; margin-top: 10px; }
th, td { padding: 12px; border-bottom: 1px solid #e2e8f0; }
th { background-color: #f8fafc; font-weight: 600; color: #475569; }

.badge, .status-badge, .status { padding: 4px 8px; border-radius: 12px; font-size: 11px; font-weight: bold; text-transform: uppercase; }
.bg-blue, .on-scene { background-color: #dbeafe; color: #1e40af; }
.bg-green, .status-ok, .valid, .badge-signed, .available { background-color: #dcfce3; color: #166534; }
.expired { background-color: #fee2e2; color: #991b1b; }
.badge-pending, .en-route { background-color: #ffedd5; color: #9a3412; }

.prio, .call-prio { padding: 3px 6px; border-radius: 4px; color: white; font-weight: bold; font-size: 10px; }
.cat-1 { background-color: #dc2626; } 
.cat-2 { background-color: #ea580c; } 
.cat-3 { background-color: #ca8a04; } 

/* =========================================
   8. SPECIFIC COMPONENT STYLES
   ========================================= */

/* Asset Kits */
.kit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.kit-card { border: 1px solid #e2e8f0; border-radius: 8px; padding: 15px; background: #f8fafc; }
.kit-card h4 { margin: 0 0 10px 0; color: #1e293b; border-bottom: 1px solid #cbd5e1; padding-bottom: 5px;}
.kit-item-list { font-size: 13px; padding-left: 20px; color: #475569; margin: 0; }
.batch-text { color: #64748b; font-size: 11px; font-style: italic; }

/* Call/Dispatch Lists & Logs */
.active-call-item { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px; padding: 12px; margin-bottom: 10px; cursor: pointer; transition: 0.2s; }
.active-call-item:hover { border-color: #2563eb; background: #eff6ff; }
.active-call-item.selected { border-left: 5px solid #2563eb; background: #eff6ff; }
.active-call-header { display: flex; justify-content: space-between; font-weight: bold; font-size: 13px; }

.log-entry { font-size: 12px; border-left: 2px solid #cbd5e1; padding-left: 10px; margin-bottom: 10px; color: #475569; }
.log-time { font-weight: bold; color: #2563eb; margin-right: 5px; }

/* Dashboard Incident Details */
.incident-details-box { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; background: #f1f5f9; padding: 15px; border-radius: 6px; border-left: 6px solid #2563eb; }
.detail-item label { display: block; font-size: 11px; font-weight: bold; color: #64748b; text-transform: uppercase; }
.detail-item p { margin: 5px 0 0 0; font-size: 14px; font-weight: 600; color: #1e293b; }
.notes-area { grid-column: 1 / -1; margin-top: 10px; padding-top: 10px; border-top: 1px dashed #cbd5e1; }

/* Uploads & Filtering */
.upload-zone { border: 2px dashed #cbd5e1; padding: 30px; text-align: center; border-radius: 8px; background-color: #f8fafc; cursor: pointer; transition: 0.3s; }
.upload-zone:hover { border-color: #2563eb; background-color: #eff6ff; }
.upload-zone p { margin: 0; color: #64748b; font-size: 14px; }

.filter-bar { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 15px; margin-bottom: 20px; background: #f8fafc; padding: 15px; border-radius: 8px; border: 1px solid #e2e8f0; }

/* Patient Report Signatures */
.conditional-box { display: none; grid-column: 1 / -1; background-color: #f8fafc; padding: 15px; border-radius: 5px; border-left: 4px solid #2563eb; margin-top: -5px; }
.signature-wrapper { border: 2px dashed #cbd5e1; border-radius: 5px; background-color: white; margin-top: 5px; overflow: hidden; }
canvas { width: 100%; height: 150px; cursor: crosshair; display: block; touch-action: none; }
.clear-btn { background-color: #e2e8f0; color: #475569; border: none; padding: 5px 10px; font-size: 12px; cursor: pointer; width: 100%; font-weight: bold; }
.clear-btn:hover { background-color: #cbd5e1; }

/* Policy Library */
.category-card { background: white; border-radius: 8px; padding: 15px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); height: fit-content; }
.category-list { list-style: none; padding: 0; margin: 0; }
.category-item { padding: 10px; border-radius: 5px; cursor: pointer; color: #475569; font-weight: 500; margin-bottom: 5px; }
.category-item:hover { background-color: #f1f5f9; color: #2563eb; }
.category-item.active { background-color: #eff6ff; color: #2563eb; font-weight: bold; }
.policy-item { display: flex; justify-content: space-between; align-items: center; padding: 15px 0; border-bottom: 1px solid #e2e8f0; }
.policy-item:last-child { border-bottom: none; }
.policy-info h4 { margin: 0 0 5px 0; color: #0f172a; }
.policy-info span { font-size: 12px; color: #64748b; }