/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: #1a1d23;
    color: #e2e8f0;
    margin: 0;
    padding: 0;
    font-size: 14px;
    line-height: 1.5;
}

/* ---- Header ---- */
.site-header {
    background: #0f1117;
    border-bottom: 2px solid #007bff;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 500;
}
.header-title { display: flex; align-items: baseline; gap: 12px; }
.callsign {
    font-size: 1.5em;
    font-weight: 800;
    color: #4fc3f7;
    letter-spacing: 2px;
}
.subtitle { font-size: 0.9em; color: #94a3b8; }
.header-status { display: flex; gap: 10px; flex-wrap: wrap; }
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 600;
    background: #2d3748;
    border: 1px solid #4a5568;
    color: #a0aec0;
    transition: all 0.3s;
}
.status-pill .dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #718096;
    display: inline-block;
}
.status-pill.connected { background: #1a3a2a; border-color: #48bb78; color: #9ae6b4; }
.status-pill.connected .dot { background: #48bb78; box-shadow: 0 0 6px #48bb78; }
.status-pill.disconnected { background: #3a1a1a; border-color: #fc8181; color: #feb2b2; }
.status-pill.disconnected .dot { background: #fc8181; }

/* ---- Main layout ---- */
.page-main { padding: 16px; max-width: 1600px; margin: 0 auto; }

/* ---- Map ---- */
#map {
    height: 520px;
    width: 100%;
    border-radius: 8px;
    border: 2px solid #2d3748;
    margin-bottom: 16px;
}

/* ---- Cards ---- */
.card {
    background: #242831;
    border: 1px solid #2d3748;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

/* ---- Controls ---- */
.controls-card {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 16px;
}
.control-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.msg-group { flex: 1; min-width: 300px; }
.msg-log-group { flex: 1; min-width: 200px; flex-direction: column; align-items: flex-start; }
.log-label { font-size: 0.75em; color: #718096; text-transform: uppercase; margin-bottom: 4px; }

input[type="text"] {
    background: #1a1d23;
    border: 1px solid #4a5568;
    border-radius: 4px;
    color: #e2e8f0;
    padding: 7px 10px;
    font-size: 0.9em;
    outline: none;
}
input[type="text"]:focus { border-color: #4fc3f7; }
input[type="text"]::placeholder { color: #4a5568; }

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.85em;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.15s;
}
.btn:hover { opacity: 0.85; }
.btn-green { background: #38a169; color: #fff; }
.btn-blue  { background: #3182ce; color: #fff; }

#message-log {
    width: 100%;
    min-width: 180px;
    height: 72px;
    overflow-y: auto;
    background: #1a1d23;
    border: 1px solid #2d3748;
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 0.8em;
    color: #a0aec0;
}
#message-log p { margin: 0; padding: 2px 0; border-bottom: 1px solid #2d3748; }

/* ---- Stats ---- */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.stat-card {
    background: #242831;
    border: 1px solid #2d3748;
    border-radius: 8px;
    padding: 14px 10px;
    text-align: center;
}
.stat-value { font-size: 1.8em; font-weight: 700; color: #4fc3f7; line-height: 1.1; }
.stat-label { font-size: 0.72em; color: #718096; margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }

/* ---- Two-column layout ---- */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
@media (max-width: 700px) { .two-col { grid-template-columns: 1fr; } }

/* ---- Section headers ---- */
.section-header {
    font-size: 1em;
    font-weight: 700;
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.airport-header { color: #fc8181; border-color: #c53030; }
.mesh-header    { color: #b794f4; border-color: #6b46c1; }
.aprs-header    { color: #4fc3f7; border-color: #2b6cb0; }
.alerts-header  { color: #fbd38d; border-color: #c05621; }

.badge {
    background: #2b6cb0;
    color: #bee3f8;
    font-size: 0.7em;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 700;
    margin-left: auto;
}

/* ---- Tables ---- */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85em;
}
thead th {
    background: #1a1d23;
    color: #94a3b8;
    text-align: left;
    padding: 8px 10px;
    font-weight: 600;
    font-size: 0.78em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #2d3748;
    position: sticky;
    top: 0;
}
tbody tr { border-bottom: 1px solid #2d3748; transition: background 0.1s; }
tbody tr:hover { background: #2d3748; }
tbody td { padding: 7px 10px; color: #cbd5e0; vertical-align: middle; }
tbody tr:last-child { border-bottom: none; }

/* Coloring for airport status */
.status-ok    { color: #68d391; font-weight: 600; }
.status-delay { color: #fc8181; font-weight: 600; }

.table-scroll { overflow-x: auto; }

/* ---- NWS Alert items ---- */
.alerts-card { }
#no-alerts {
    color: #68d391;
    font-weight: 600;
    padding: 8px 0;
}

.alert-item {
    padding: 10px 14px;
    margin-bottom: 8px;
    border-radius: 6px;
    border-left: 5px solid #718096;
    background: #1a1d23;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: baseline;
}
.alert-item.sev-extreme { border-color: #e53e3e; background: #2d1515; }
.alert-item.sev-severe  { border-color: #dd6b20; background: #2d1e10; }
.alert-item.sev-moderate{ border-color: #d69e2e; background: #2d2510; }
.alert-item.sev-minor   { border-color: #3182ce; background: #101e2d; }
.alert-item.sev-unknown { border-color: #718096; background: #1a1d23; }

.alert-event { font-weight: 700; color: #e2e8f0; }
.alert-sev {
    font-size: 0.72em;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 700;
    background: #2d3748;
    color: #a0aec0;
    text-transform: uppercase;
}
.sev-extreme .alert-sev  { background: #742a2a; color: #fed7d7; }
.sev-severe  .alert-sev  { background: #7b341e; color: #fbd38d; }
.sev-moderate .alert-sev { background: #744210; color: #fefcbf; }
.sev-minor   .alert-sev  { background: #2a4365; color: #bee3f8; }

.alert-area { width: 100%; font-size: 0.82em; color: #94a3b8; margin-top: 2px; }

/* ---- Fixed bottom ticker ---- */
#alert-ticker {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: #7b341e;
    color: #fbd38d;
    padding: 8px 16px;
    font-size: 0.85em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 36px;
    border-top: 2px solid #c05621;
    overflow: hidden;
}
#alert-ticker.clear {
    background: #1a3a2a;
    color: #9ae6b4;
    border-top-color: #276749;
}
#alert-ticker.hidden { display: none; }

.ticker-label {
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 1px;
}
#ticker-text { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
