/* ===========================================
   MFB RDO Tracker - Main Stylesheet
   =========================================== */

/* ===========================================
   CSS RESET & VARIABLES
   =========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* CFA Color Scheme */
    --primary-color: #d32f2f;
    --secondary-color: #ff6b35;
    --bg-gradient-start: #1565c0;
    --bg-gradient-end: #0d47a1;
    --container-bg: rgba(255, 255, 255, 0.96);
    --text-color: #1a1a1a;
    --card-bg: #f5f5f5;
    --table-bg: #ffffff;
    --table-header-bg: #f0f0f0;
    --border-color: #e0e0e0;
    --hover-bg: #f8f8f8;
    --input-bg: #ffffff;
    --input-border: #c0c0c0;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-dark: rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] {
    --bg-gradient-start: #1a1a1a;
    --bg-gradient-end: #2d2d2d;
    --container-bg: rgba(30, 30, 30, 0.95);
    --text-color: #e0e0e0;
    --card-bg: #3a3a3a;
    --table-bg: #2a2a2a;
    --table-header-bg: #3a3a3a;
    --border-color: #4a4a4a;
    --hover-bg: #3a3a3a;
    --input-bg: #2a2a2a;
    --input-border: #4a4a4a;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-dark: rgba(0, 0, 0, 0.6);
}

/* ===========================================
   LAYOUT STYLES
   =========================================== */
body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    color: var(--text-color);
    min-height: 100vh;
    padding: 20px;
    transition: all 0.3s ease;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    background: var(--container-bg);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px var(--shadow-dark);
}

header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 3px solid var(--primary-color);
    position: relative;
    transition: all 0.3s ease;
}

h1 {
    color: var(--primary-color);
    font-size: 2.2em;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px var(--shadow);
}

/* ===========================================
   HEADER CONTROLS
   =========================================== */
.header-controls,
.header-left-controls {
    position: absolute;
    top: 0;
    display: flex;
    gap: 10px;
    align-items: center;
}

.header-controls { right: 0; }
.header-left-controls { left: 0; }

.btn-control {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.3s ease;
    white-space: nowrap;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-control:hover {
    background: #b71c1c;
    transform: translateY(-2px);
}

.btn-control.theme-toggle {
    font-size: 1.2em;
    padding: 8px 10px;
    width: 36px;
}

.btn-control.clear-sheet {
    background: #ff5722;
}

.btn-control.clear-sheet:hover {
    background: #e64a19;
}

.btn-control.active {
    background: #4caf50;
}


/* ===========================================
   STATISTICS DASHBOARD
   =========================================== */
.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--card-bg);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    border-left: 4px solid var(--primary-color);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow);
}

.stat-number {
    font-size: 1.6em;
    font-weight: bold;
    color: var(--primary-color);
    display: block;
}

.stat-label {
    color: var(--text-color);
    font-size: 0.8em;
    margin-top: 5px;
    opacity: 0.8;
}

/* ===========================================
   STATION SECTIONS
   =========================================== */
.station-section {
    margin-bottom: 30px;
}

.station-section.hidden {
    display: none;
}

.station-header {
    background: var(--primary-color);
    color: white;
    padding: 12px 20px;
    border-radius: 10px 10px 0 0;
    font-size: 1.2em;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.station-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}


/* ===========================================
   TRUCK TABLES
   =========================================== */
.appliance-table {
    width: 100%;
    background: var(--table-bg);
    border-collapse: collapse;
    box-shadow: 0 4px 6px var(--shadow);
    border-radius: 0 0 10px 10px;
    overflow: hidden;
}

.appliance-table th {
    background: var(--table-header-bg);
    color: var(--text-color);
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    font-size: 0.85em;
}

.appliance-table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.appliance-table tr:hover {
    background: var(--hover-bg);
}


/* ===========================================
   TRUCK NAMES & STATUS
   =========================================== */
.appliance-name {
    font-weight: bold;
    color: var(--text-color);
    display: flex;
    align-items: center;
    font-size: 11pt;
}

.appliance-name-input {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-color);
    font-weight: bold;
    padding: 4px;
    border-radius: 3px;
    width: 100%;
}

.status-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 10px;
}

/* Status Colors */
.status-offline { background-color: #6c757d; }
.status-in-station { background-color: #28a745; }
.status-responding { background-color: #ffc107; }
.status-on-scene { background-color: #fd7e14; }
.status-available { background-color: #17a2b8; }
.status-transporting { background-color: #6f42c1; }
.status-returning { background-color: #20c997; }
.status-unavailable { background-color: #dc3545; }

/* ===========================================
   FORM INPUTS
   =========================================== */
.appliance-table select,
.appliance-table input[type="text"] {
    width: 100%;
    padding: 5px;
    border: 1px solid var(--input-border);
    border-radius: 4px;
    font-size: 0.8em;
    background: var(--input-bg);
    color: var(--text-color);
}

.appliance-table select {
    font-weight: bold;
}

.crew-inputs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3px;
}

.crew-input {
    padding: 4px;
    border: 1px solid var(--input-border);
    border-radius: 3px;
    font-size: 0.75em;
    text-align: center;
    background: var(--input-bg);
    color: var(--text-color);
}

.agencies-checkboxes {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.agency-checkbox {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 0.75em;
}

.agency-checkbox input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.agency-checkbox label {
    color: var(--text-color);
}

/* ===========================================
   BUTTONS
   =========================================== */
.btn {
    padding: 4px 8px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.75em;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
}

.btn-primary:hover {
    background-color: #b71c1c;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-delete {
    background: #f44336;
    color: white;
}

.btn-delete:hover {
    background: #da190b;
}

.add-truck-btn,
.station-edit-btn,
.station-delete-btn,
.add-station-btn,
.manage-options-btn {
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid white;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75em;
    transition: all 0.3s ease;
}


.add-truck-btn:hover,
.station-edit-btn:hover,
.station-delete-btn:hover,
.add-station-btn:hover,
.manage-options-btn:hover {
    background: white;
    color: var(--primary-color);
}


.action-buttons {
    display: flex;
    gap: 4px;
}

/* ===========================================
   MODALS
   =========================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: var(--table-bg);
    margin: 10% auto;
    padding: 20px;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    color: var(--text-color);
    max-height: 80vh;
    overflow-y: auto;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: var(--text-color);
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.modal input[type="text"] {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--input-border);
    border-radius: 4px;
    background: var(--input-bg);
    color: var(--text-color);
    margin-bottom: 10px;
}

.modal label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--text-color);
}

/* ===========================================
   INDICATORS
   =========================================== */
.mode-indicator {
    position: fixed;
    right: 20px;
    color: white;
    padding: 8px 16px;
    border-radius: 5px;
    font-weight: bold;
    display: none;
    z-index: 1000;
    font-size: 0.9em;
}

.filter-indicator {
    top: 20px;
    background: #4caf50;
}

.filter-active .filter-indicator {
    display: block;
}

.compact-indicator {
    top: 60px;
    background: #673ab7;
}

.compact-mode .compact-indicator {
    display: block;
}

/* ===========================================
   OPTIONS MANAGEMENT
   =========================================== */
.options-list {
    display: grid;
    gap: 10px;
    margin-bottom: 20px;
}

.option-item {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px;
    background: var(--card-bg);
    border-radius: 5px;
}

.option-item input {
    flex: 1;
}

.option-item button {
    padding: 5px 10px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    background: #f44336;
    color: white;
}

/* ===========================================
   COMPACT MODE STYLES
   =========================================== */

/* Compact mode button styling */
.btn-control.compact-toggle {
    background: #673ab7;
}

.btn-control.compact-toggle:hover {
    background: #512da8;
}

.btn-control.compact-toggle.active {
    background: #4caf50;
}

/* Compact mode layout adjustments */
.compact-mode {
    padding: 10px;
}

.compact-mode header {
    margin-bottom: 10px;
    padding-bottom: 8px;
}

.compact-mode h1 {
    font-size: 1.5em;
    margin-bottom: 8px;
}

/* Hide statistics dashboard in compact mode */
.compact-mode .summary-stats {
    display: none;
}

/* Compact station sections */
.compact-mode .station-section {
    margin-bottom: 15px;
}

/* Compact station headers - show but make smaller */
.compact-mode .station-header {
    padding: 6px 12px;
    font-size: 0.9em;
    margin-bottom: 5px;
    border-radius: 3px;
}

/* Compact table styling */
.compact-mode .appliance-table {
    margin-bottom: 10px;
    border-radius: 5px;
}

.compact-mode .appliance-table th,
.compact-mode .appliance-table td {
    padding: 6px 4px;
    font-size: 0.95em; /* Increased from 0.8em (about 2pt larger) */
}

.compact-mode .appliance-table th {
    font-size: 0.9em; /* Increased from 0.75em (about 2pt larger) */
    padding: 8px 4px;
}

/* Compact form inputs */
.compact-mode .appliance-table select,
.compact-mode .appliance-table input[type="text"] {
    padding: 3px;
    font-size: 0.9em; /* Increased from 0.75em (about 2pt larger) */
}

.compact-mode .crew-inputs {
    gap: 2px;
}

.compact-mode .crew-input {
    padding: 3px;
    font-size: 0.85em; /* Increased from 0.7em (about 2pt larger) */
}

.compact-mode .agencies-checkboxes {
    gap: 4px;
}

.compact-mode .agency-checkbox {
    font-size: 0.85em; /* Increased from 0.7em (about 2pt larger) */
}

/* Compact appliance names */
.compact-mode .appliance-name {
    font-size: 1em; /* Increased from 0.85em (about 2pt larger) */
}

.compact-mode .status-indicator {
    width: 10px;
    height: 10px;
    margin-right: 6px;
}

/* Reduce overall container padding */
.compact-mode .container {
    padding: 10px;
}

/* Compact header controls */
.compact-mode .header-controls,
.compact-mode .header-left-controls {
    gap: 6px;
}

.compact-mode .btn-control {
    padding: 6px 10px;
    font-size: 0.8em;
    height: 32px;
}

/* Additional compact mode refinements */
.compact-mode body {
    padding: 10px;
}

.compact-mode .appliance-table tr:hover {
    background: var(--hover-bg);
}

/* Compact mode: reduce table spacing even more */
.compact-mode .appliance-table th:first-child,
.compact-mode .appliance-table td:first-child {
    padding-left: 6px;
}

.compact-mode .appliance-table th:last-child,
.compact-mode .appliance-table td:last-child {
    padding-right: 6px;
}

/* Compact mode: tighter agency checkboxes */
.compact-mode .agency-checkbox input[type="checkbox"] {
    transform: scale(0.8);
}

/* Compact mode: smaller control point inputs */
.compact-mode .appliance-table input[type="text"] {
    min-height: 24px;
}

/* Compact mode: ensure tables are closely spaced */
.compact-mode .appliance-table {
    box-shadow: 0 2px 4px var(--shadow);
}


