/* style.css */
:root {
    --bg-dark: #1a1a2e;
    --card-dark: #1f213a;
    --primary-blue: #4a90e2;
    --accent-amber: #f5a623;
    --text-light: #e0e6f0;
    --text-muted: #8a93a5;
    --border-color: #3a3d5b;
    --success-green: #2ecc71;
    --danger-red: #e74c3c;
    --font-family: 'Exo 2', sans-serif;
    --border-radius: 8px;
    --box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: var(--font-family);
    background-color: var(--bg-dark);
    color: var(--text-light);
    margin: 0;
    line-height: 1.6;
}

.container { max-width: 1600px; margin: 0 auto; padding: 20px; }

/* Navigation */
.main-nav {
    background-color: var(--card-dark);
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    box-shadow: var(--box-shadow);
    border: 1px solid var(--border-color);
}
.nav-title { font-size: 1.5em; font-weight: 600; color: var(--primary-blue); }
.pilot-info { text-align: right; }
.pilot-info span { display: block; }
.pilot-info .airline-name { font-size: 1.1em; font-weight: 600; }
.pilot-info .hub-info { font-size: 0.9em; color: var(--text-muted); }

/* Main Layout */
.main-content { display: flex; gap: 20px; }
.sidebar {
    flex: 0 0 240px;
    background-color: var(--card-dark);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    border: 1px solid var(--border-color);
    align-self: flex-start;
}
.sidebar h2 {
    margin-top: 0;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 15px;
    color: var(--primary-blue);
    font-weight: 600;
}
.nav-menu { list-style: none; padding: 0; margin: 0; }
.nav-menu li { margin-bottom: 10px; }
.nav-button {
    background: none; border: none; color: var(--text-light);
    padding: 12px 15px; text-align: left; width: 100%;
    cursor: pointer; font-size: 1em; font-family: var(--font-family);
    border-radius: 6px; transition: all 0.2s ease;
}
.nav-button:hover { background-color: #2c2f4e; color: white; }
.nav-button.active { background-color: var(--primary-blue); color: white; font-weight: 600; }
.sidebar-footer {
    margin-top: 30px; padding-top: 15px;
    border-top: 1px solid var(--border-color);
    font-size: 0.9em; text-align: center;
}
#pilotStatus { color: var(--accent-amber); margin-bottom: 15px; }

.content-area { flex-grow: 1; }
.content-section { animation: fadeIn 0.5s ease; }
.content-section.hidden, .hidden { display: none !important; }

/* Cards */
.card {
    background-color: var(--card-dark);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}
.card-header { background-color: #2c2f4e; padding: 15px 20px; border-bottom: 1px solid var(--border-color); }
.card-header h3 { margin: 0; font-weight: 600; }
.card-content { padding: 20px; }
.card-footer { background-color: #2c2f4e; padding: 15px 20px; border-top: 1px solid var(--border-color); text-align: right; }

/* Dispatch & Manifest */
.dispatch-center { text-align: center; padding: 20px; }
.dispatch-center h3 { font-size: 1.5em; margin-bottom: 10px; }
.dispatch-center p { color: var(--text-muted); margin-bottom: 25px; }

.dispatch-selector { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 15px; }
.dispatch-option {
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
}
.dispatch-option:hover { transform: translateY(-3px); border-color: var(--primary-blue); }
.dispatch-option h4 { margin: 0 0 5px 0; color: var(--primary-blue); }
.dispatch-option p { margin: 0; font-size: 0.9em; color: var(--text-muted); }

.flight-manifest-card { border-left: 5px solid var(--primary-blue); }
#print-container { padding: 30px; }
.manifest-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.manifest-header h3 { margin: 0; font-size: 2em; color: var(--primary-blue); }
.manifest-header .flight-details { text-align: right; }
.manifest-details { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; }
.detail-group { background: var(--bg-dark); padding: 15px; border-radius: 6px; }
.detail-group h4 { margin-top: 0; color: var(--accent-amber); border-bottom: 1px solid var(--border-color); padding-bottom: 8px; }
.detail-item { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 1.1em; }
.detail-item .label { color: var(--text-muted); }
.detail-item .value { font-weight: 600; }
.metar { font-family: 'Courier New', Courier, monospace; font-size: 1em; background: #111; padding: 10px; border-radius: 4px; margin-top: 10px; white-space: pre-wrap; word-break: break-all; }
.metar-parsed { font-size: 0.9em; color: var(--text-muted); font-style: italic; margin-top: 5px; }

/* Tables & Fleet List */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 15px; text-align: left; border-bottom: 1px solid var(--border-color); }
th { background-color: #2c2f4e; font-weight: 600; }
tbody tr { transition: background-color 0.2s ease; }
tbody tr:hover { background-color: #2c2f4e; }
#fleetListContainer ul { list-style: none; padding: 0; margin: 0; }
#fleetListContainer li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 5px;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}
#fleetListContainer li:hover { background-color: #2c2f4e; }
#fleetListContainer li:last-child { border: none; }
.remove-aircraft-btn {
    background: none; border: none; color: var(--danger-red);
    cursor: pointer; font-size: 1.2em; transition: color 0.2s;
    padding: 5px;
}
.remove-aircraft-btn:hover { color: #ff7669; }

/* Buttons */
.button {
    background-color: var(--primary-blue); color: white;
    border: none; padding: 12px 24px; border-radius: 6px;
    cursor: pointer; font-size: 1em; font-weight: 600;
    font-family: var(--font-family); transition: all 0.2s ease;
}
.button:hover { background-color: #357abd; transform: translateY(-1px); }
.button-outline { background-color: transparent; border: 2px solid var(--primary-blue); color: var(--primary-blue); }
.button-outline:hover { background-color: var(--primary-blue); color: white; }
.button-danger { background-color: var(--danger-red); }
.button-danger:hover { background-color: #c0392b; }
.button-success { background-color: var(--success-green); }
.button-success:hover { background-color: #27ae60; }
.button-small { padding: 8px 16px; font-size: 0.9em; }

/* Modals & Overlays */
.modal-overlay, .loading-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.7); display: flex;
    justify-content: center; align-items: center; z-index: 1000;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}
.modal-content {
    background-color: var(--card-dark); padding: 30px;
    border-radius: var(--border-radius); box-shadow: var(--box-shadow);
    width: 90%; max-width: 500px; border: 1px solid var(--border-color);
}
.modal-content h2 { margin-top: 0; color: var(--primary-blue); }
.modal-buttons { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.loading-overlay { flex-direction: column; color: white; font-size: 1.2em; }
.spinner {
    width: 50px; height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

/* Aircraft Selection Modal */
#aircraftSelectionList {
    margin-top: 20px;
    max-height: 40vh;
    overflow-y: auto;
}
.aircraft-select-option {
    display: block;
    width: 100%;
    padding: 15px;
    margin-bottom: 10px;
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-light);
    font-family: var(--font-family);
    font-size: 1.1em;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}
.aircraft-select-option:hover {
    border-color: var(--primary-blue);
    background-color: #2c2f4e;
}
.aircraft-select-option:last-child {
    margin-bottom: 0;
}


/* Forms */
form label { display: block; margin-bottom: 5px; font-weight: 600; color: var(--text-muted); }
form input, form select {
    width: 100%; padding: 12px; margin-bottom: 15px;
    border: 1px solid var(--border-color); border-radius: 6px;
    background-color: var(--bg-dark); color: var(--text-light);
    font-family: var(--font-family); font-size: 1em;
}
form button[type="submit"] { width: 100%; margin-top: 10px; }

/* Utility & Print */
@media print {
    body, .container, .main-content, .card {
        background: white !important;
        color: black !important;
        box-shadow: none;
    }
    body * { display: none; }
    #print-container, #print-container * {
        display: block !important;
        color: black !important;
    }
    #print-container { position: absolute; left: 0; top: 0; width: 100%; }
    .manifest-details { grid-template-columns: 1fr; }
    .card-footer { display: none !important; }
    h3, h4 { color: #333 !important; }
    .metar { background: #eee !important; color: #333 !important; }
}

@media (max-width: 992px) {
    .main-content { flex-direction: column; }
    .sidebar { flex: 1; align-self: stretch; }
    .manifest-details { grid-template-columns: 1fr; }
}