/* Base styles */
html, body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    height: 100%;
    margin: 0;
    padding: 0;
}

/* Validation styles */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
    font-size: 0.875rem;
}

/* Error UI */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

/* Loading progress */
.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: #1b6ec2;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}

/* ============================================
   MAIN LAYOUT STYLES
   ============================================ */

.page {
    display: flex;
    flex-direction: row;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: linear-gradient(180deg, #1e3a5f 0%, #2d5a87 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0,0,0,0.2);
    transition: width 0.2s ease;
}

.sidebar-header {
    padding: 1rem;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.1);
}

.sidebar-header h4 {
    margin: 0;
    font-weight: 600;
    font-size: 1.1rem;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Sidebar collapse toggle button */
.btn-collapse-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 1rem;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.btn-collapse-toggle:hover {
    background: rgba(255,255,255,0.2);
}

/* Collapsed sidebar state */
.sidebar.collapsed {
    width: 60px;
}

.sidebar.collapsed .sidebar-header h4 {
    font-size: 0.9rem;
}

.sidebar.collapsed .nav-link span {
    display: none;
}

.sidebar.collapsed .nav-section-header span {
    display: none;
}

.sidebar.collapsed .nav-section-header {
    justify-content: center;
    padding: 0.75rem;
}

.sidebar.collapsed .nav-section-header > i:last-child {
    display: none;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 1rem;
}

.sidebar.collapsed .nav-link i {
    margin-right: 0;
}

.sidebar.collapsed .nav-section-content .nav-link {
    padding-left: 1rem;
}

.sidebar.collapsed .btn-collapse-toggle {
    padding: 0.5rem;
}

.sidebar.collapsed .btn-logout {
    padding: 0.5rem;
    justify-content: center;
}

/* Main content area */
main {
    flex: 1;
    margin-left: 250px;
    padding: 1.5rem;
    background-color: #f5f7fa;
    min-height: 100vh;
    transition: margin-left 0.2s ease;
}

main.sidebar-collapsed {
    margin-left: 60px;
}

/* ============================================
   NAVIGATION MENU STYLES
   ============================================ */

.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    margin: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: rgba(255,255,255,0.1);
    color: white;
    border-left-color: #4da6ff;
}

.nav-link.active {
    background: rgba(255,255,255,0.15);
    color: white;
    border-left-color: #4da6ff;
}

.nav-link i {
    width: 24px;
    margin-right: 0.75rem;
    font-size: 1.1rem;
}

/* Nav section headers */
.nav-section {
    margin-top: 0.5rem;
}

.nav-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    color: rgba(255,255,255,0.6);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    user-select: none;
}

.nav-section-header:hover {
    color: rgba(255,255,255,0.8);
}

.nav-section-content {
    overflow: hidden;
    max-height: 500px;
    transition: max-height 0.3s ease;
}

.nav-section-content.collapsed {
    max-height: 0;
}

.nav-section-content .nav-link {
    padding-left: 2.5rem;
    font-size: 0.9rem;
}

/* Logout button */
.btn-logout {
    width: 100%;
    background: rgba(220, 53, 69, 0.9);
    border: none;
    color: white;
    padding: 0.75rem;
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background: #dc3545;
}

/* ============================================
   DISPATCH PAGE STYLES
   ============================================ */

.dispatch-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #dee2e6;
}

.dispatch-header h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 600;
    color: #1e3a5f;
}

.dispatch-actions {
    display: flex;
    gap: 0.5rem;
}

.connection-status {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.85rem;
    font-weight: 500;
}

.connection-status.connected {
    background: #d4edda;
    color: #155724;
}

.connection-status.disconnected {
    background: #f8d7da;
    color: #721c24;
}

.connection-status i {
    margin-right: 0.5rem;
}

/* Filter tabs */
.filter-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.filter-tab {
    padding: 0.5rem 1rem;
    border: 1px solid #dee2e6;
    background: white;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.filter-tab:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.filter-tab.active {
    background: #1e3a5f;
    color: white;
    border-color: #1e3a5f;
}

/* Incidents table */
.incidents-table {
    width: 100%;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

.incidents-table thead {
    background: #f8f9fa;
}

.incidents-table th {
    padding: 0.875rem 1rem;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.incidents-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

.incidents-table tbody tr:hover {
    background: #f8f9fa;
}

.incidents-table tbody tr:last-child td {
    border-bottom: none;
}

/* CAD Number link */
.cad-link {
    font-weight: 600;
    color: #0d6efd;
    text-decoration: none;
}

.cad-link:hover {
    text-decoration: underline;
}

/* Incident link in unit cards */
.incident-link {
    font-weight: 600;
    color: #0d6efd;
    text-decoration: none;
}

.incident-link:hover {
    text-decoration: underline;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.active {
    background: #d4edda;
    color: #155724;
}

.status-badge.pending {
    background: #fff3cd;
    color: #856404;
}

.status-badge.closed {
    background: #e2e3e5;
    color: #383d41;
}

.status-badge.on-hold {
    background: #cce5ff;
    color: #004085;
}

/* Elapsed time */
.elapsed-time {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    display: inline-block;
    min-width: 90px;
    text-align: center;
}

/* Elapsed time color classes */
.elapsed-time.elapsed-green {
    background-color: #d4edda;
    color: #155724;
}

.elapsed-time.elapsed-yellow {
    background-color: #fff3cd;
    color: #856404;
}

.elapsed-time.elapsed-orange {
    background-color: #ffe5cc;
    color: #cc5500;
}

.elapsed-time.elapsed-red {
    background-color: #f8d7da;
    color: #721c24;
    animation: pulse-red 1s ease-in-out infinite;
}

@keyframes pulse-red {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Legacy classes for backwards compatibility */
.elapsed-time.warning {
    background-color: #fff3cd;
    color: #856404;
}

.elapsed-time.danger {
    background-color: #f8d7da;
    color: #721c24;
}

/* Action buttons */
.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-action {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 0.25rem;
}

/* ============================================
   UNITS SECTION
   ============================================ */

.units-section {
    margin-top: 2rem;
}

.units-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.unit-card {
    background: white;
    border-radius: 0.5rem;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-left: 4px solid #28a745;
}

.unit-card.assigned {
    border-left-color: #007bff;
}

.unit-card.offline {
    border-left-color: #6c757d;
    opacity: 0.7;
}

.unit-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.unit-name {
    font-weight: 600;
    font-size: 1rem;
}

.unit-status {
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    background: #e9ecef;
}

.unit-assignment {
    font-size: 0.85rem;
    color: #6c757d;
}

/* ============================================
   LOGIN PAGE STYLES
   ============================================ */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 100%);
}

.login-card {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h2 {
    color: #1e3a5f;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: #6c757d;
    margin: 0;
}

.login-form .form-group {
    margin-bottom: 1.25rem;
}

.login-form label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #495057;
}

.login-form .form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.login-form .form-control:focus {
    border-color: #1e3a5f;
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.15);
    outline: none;
}

.login-form .checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.login-form .checkbox-label input {
    margin-right: 0.5rem;
}

.login-form .btn-primary {
    width: 100%;
    padding: 0.875rem;
    background: #1e3a5f;
    border: none;
    border-radius: 0.375rem;
    font-size: 1rem;
    font-weight: 600;
    transition: background 0.2s;
}

.login-form .btn-primary:hover:not(:disabled) {
    background: #2d5a87;
}

.login-form .btn-primary:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.login-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e9ecef;
}

.login-footer p {
    color: #6c757d;
    font-size: 0.85rem;
    margin: 0;
}

/* Login spinner */
.login-form .spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
    margin-right: 0.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Alert styles */
.alert {
    padding: 0.875rem 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ============================================
   MODAL STYLES
   ============================================ */

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1040;
}

.modal-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1050;
    width: 100%;
    max-width: 500px;
}

.modal-content {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e9ecef;
}

.modal-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6c757d;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid #e9ecef;
}

/* ============================================
   CARD STYLES
   ============================================ */

.card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
    border: 1px solid #e9ecef;
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 0.5rem 0.5rem 0 0;
}

.card-header h5 {
    margin: 0;
    font-weight: 600;
}

.card-body {
    padding: 1.25rem;
}

/* ============================================
   TABLE STYLES
   ============================================ */

.table {
    width: 100%;
    margin-bottom: 1rem;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid #e9ecef;
}

.table thead th {
    font-weight: 600;
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

/* ============================================
   BUTTON STYLES
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 0.375rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn i {
    margin-right: 0.5rem;
}

.btn-primary {
    background: #1e3a5f;
    color: white;
    border-color: #1e3a5f;
}

.btn-primary:hover {
    background: #2d5a87;
    border-color: #2d5a87;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border-color: #6c757d;
}

.btn-secondary:hover {
    background: #5a6268;
    border-color: #545b62;
}

.btn-success {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

.btn-success:hover {
    background: #218838;
    border-color: #1e7e34;
}

.btn-danger {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

.btn-danger:hover {
    background: #c82333;
    border-color: #bd2130;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
    border-color: #ffc107;
}

.btn-warning:hover {
    background: #e0a800;
    border-color: #d39e00;
}

.btn-info {
    background: #17a2b8;
    color: white;
    border-color: #17a2b8;
}

.btn-info:hover {
    background: #138496;
    border-color: #117a8b;
}

.btn-outline-primary {
    background: transparent;
    color: #1e3a5f;
    border-color: #1e3a5f;
}

.btn-outline-primary:hover {
    background: #1e3a5f;
    color: white;
}

.btn-outline-secondary {
    background: transparent;
    color: #6c757d;
    border-color: #6c757d;
}

.btn-outline-secondary:hover {
    background: #6c757d;
    color: white;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
}

.btn-block {
    width: 100%;
}

/* ============================================
   FORM STYLES
   ============================================ */

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #495057;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    box-sizing: border-box;
}

.form-control:focus {
    border-color: #1e3a5f;
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.15);
    outline: none;
}

.form-control::placeholder {
    color: #6c757d;
    opacity: 0.7;
}

.form-select {
    display: block;
    width: 100%;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
}

.form-check {
    display: flex;
    align-items: center;
    padding-left: 0;
}

.form-check-input {
    margin-right: 0.5rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    /* Mobile: sidebar defaults to collapsed (60px) */
    .sidebar {
        width: 60px !important;
        z-index: 1050 !important;
        background: linear-gradient(180deg, #1e3a5f 0%, #2d5a87 100%) !important;
    }

    /* When expanded on mobile, overlay content with full width */
    .sidebar:not(.collapsed) {
        width: 250px !important;
        box-shadow: 4px 0 20px rgba(0,0,0,0.5) !important;
        background: linear-gradient(180deg, #1e3a5f 0%, #2d5a87 100%) !important;
    }

    /* Main content always stays at collapsed sidebar width */
    /* The expanded sidebar overlays, doesn't push */
    main {
        margin-left: 60px !important;
    }

    /* Hide text in collapsed mobile sidebar */
    .sidebar.collapsed .sidebar-header h4,
    .sidebar.collapsed .nav-link span,
    .sidebar.collapsed .nav-section-header span:first-child,
    .sidebar.collapsed .btn-collapse-toggle span,
    .sidebar.collapsed .btn-logout span {
        display: none !important;
    }

    /* Ensure text IS visible when expanded on mobile */
    .sidebar:not(.collapsed) .sidebar-header h4 {
        display: block !important;
        font-size: 1.1rem !important;
    }

    .sidebar:not(.collapsed) .nav-link span {
        display: inline !important;
    }

    .sidebar:not(.collapsed) .nav-section-header span {
        display: inline !important;
    }

    .sidebar:not(.collapsed) .nav-link {
        justify-content: flex-start !important;
        padding: 0.75rem 1rem !important;
    }

    .sidebar:not(.collapsed) .nav-link i {
        margin-right: 0.75rem !important;
        width: 24px !important;
    }

    .sidebar:not(.collapsed) .nav-section-header {
        justify-content: space-between !important;
        padding: 0.5rem 1rem !important;
    }

    .sidebar:not(.collapsed) .nav-section-header > i:last-child {
        display: inline !important;
    }

    .sidebar:not(.collapsed) .nav-section-content .nav-link {
        padding-left: 2.5rem !important;
    }

    .sidebar:not(.collapsed) .btn-collapse-toggle {
        justify-content: center !important;
        gap: 0.5rem !important;
    }

    .sidebar:not(.collapsed) .btn-collapse-toggle span {
        display: inline !important;
    }

    .sidebar:not(.collapsed) .btn-logout {
        justify-content: flex-start !important;
    }

    /* Collapsed state center alignment on mobile */
    .sidebar.collapsed .nav-link {
        justify-content: center !important;
        padding: 1rem !important;
    }

    .sidebar.collapsed .nav-section-header {
        justify-content: center !important;
        padding: 0.75rem !important;
    }

    .sidebar.collapsed .btn-collapse-toggle {
        padding: 0.5rem !important;
        justify-content: center !important;
    }

    .sidebar.collapsed .btn-logout {
        padding: 0.5rem !important;
        justify-content: center !important;
    }

    .dispatch-header {
        flex-direction: column;
        gap: 1rem;
    }

    .dispatch-actions {
        width: 100%;
        flex-wrap: wrap;
    }
}

/* ============================================
   UTILITIES
   ============================================ */

.text-muted { color: #6c757d !important; }
.text-primary { color: #1e3a5f !important; }
.text-success { color: #28a745 !important; }
.text-danger { color: #dc3545 !important; }
.text-warning { color: #ffc107 !important; }
.text-info { color: #17a2b8 !important; }

.bg-primary { background-color: #1e3a5f !important; }
.bg-secondary { background-color: #6c757d !important; }
.bg-success { background-color: #28a745 !important; }
.bg-danger { background-color: #dc3545 !important; }
.bg-warning { background-color: #ffc107 !important; }
.bg-info { background-color: #17a2b8 !important; }
.bg-light { background-color: #f8f9fa !important; }
.bg-dark { background-color: #343a40 !important; }

.fw-bold { font-weight: 600 !important; }
.fw-normal { font-weight: 400 !important; }

.d-none { display: none !important; }
.d-flex { display: flex !important; }
.d-block { display: block !important; }
.d-inline { display: inline !important; }
.d-inline-block { display: inline-block !important; }

.justify-content-center { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-end { justify-content: flex-end !important; }
.align-items-center { align-items: center !important; }

.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }

.m-0 { margin: 0 !important; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.me-1 { margin-right: 0.25rem !important; }
.me-2 { margin-right: 0.5rem !important; }
.me-3 { margin-right: 1rem !important; }
.ms-1 { margin-left: 0.25rem !important; }
.ms-2 { margin-left: 0.5rem !important; }
.ms-3 { margin-left: 1rem !important; }

.p-0 { padding: 0 !important; }
.p-1 { padding: 0.25rem !important; }
.p-2 { padding: 0.5rem !important; }
.p-3 { padding: 1rem !important; }
.p-4 { padding: 1.5rem !important; }

.w-100 { width: 100% !important; }
.h-100 { height: 100% !important; }

.text-center { text-align: center !important; }
.text-start { text-align: left !important; }
.text-end { text-align: right !important; }

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* ============================================
   Dispatch Layout with Collapsible Side Pane
   ============================================ */

.dispatch-layout {
    display: flex;
    gap: 0;
    position: relative;
}

.main-content {
    flex: 1;
    min-width: 0;
    margin-right: 40px; /* Space for collapsed pane */
    transition: margin-right 0.3s ease;
}

.dispatch-layout:has(.units-pane:not(.collapsed)) .main-content {
    margin-right: 320px;
}

/* Active Units Side Pane */
.units-pane {
    position: fixed;
    right: 0;
    top: 5rem;
    height: calc(100vh - 5rem);
    background: #d0d3d8;
    border-left: 1px solid #b0b3b8;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.2);
    transition: width 0.3s ease;
    width: 320px;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.units-pane.collapsed {
    width: 40px;
}

.pane-toggle-collapsed {
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #ffffff 0%, #e9ecef 100%);
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 15px;
    gap: 8px;
    transition: background 0.2s;
}

.pane-toggle-collapsed:hover {
    background: linear-gradient(180deg, #e0e0e0 0%, #c0c0c0 100%);
}

.pane-toggle-collapsed i {
    font-size: 1.2rem;
    color: #495057;
}

.unit-count-badge {
    background: #007bff;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.pane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #c0c3c8;
    border-bottom: 1px solid #a0a3a8;
}

.pane-header h5 {
    margin: 0;
    font-size: 1rem;
    color: #333;
}

.pane-close-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 4px;
    color: #6c757d;
    transition: all 0.2s;
}

.pane-close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
}

.pane-body {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.no-units {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 30px;
}

/* Unit Cards in Side Pane */
.units-pane .unit-card {
    background: white;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #0d6efd;
}

.units-pane .unit-card.assigned {
    border-left-color: #198754;
}

.units-pane .unit-card:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.units-pane .unit-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.units-pane .unit-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: #333;
}

.units-pane .unit-assignment {
    font-size: 0.85rem;
    padding-top: 8px;
    border-top: 1px solid #e9ecef;
}
