* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #0f1117;
    color: #e0e0e0;
    min-height: 100vh;
}

header {
    text-align: center;
    padding: 2rem 1rem 1rem;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.05em;
}

header .subtitle {
    color: #888;
    margin-top: 0.4rem;
    font-size: 0.95rem;
}

main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem 2rem;
}

/* Upload area */
.upload-area {
    border: 2px dashed #333;
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    margin: 1rem 0;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: #4a9eff;
    background: rgba(74, 158, 255, 0.05);
}

.upload-content svg {
    color: #555;
    margin-bottom: 1rem;
}

.upload-content p {
    color: #888;
    font-size: 0.95rem;
}

.file-label {
    color: #4a9eff;
    cursor: pointer;
    text-decoration: underline;
}

#file-input {
    display: none;
}

/* Loading */
.loading {
    text-align: center;
    padding: 3rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #333;
    border-top-color: #4a9eff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error */
.error {
    background: rgba(255, 60, 60, 0.1);
    border: 1px solid #ff3c3c;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin: 1rem 0;
    color: #ff6b6b;
}

/* Summary card */
.summary-card {
    background: #1a1d27;
    border-radius: 10px;
    padding: 1.2rem 1.5rem;
    margin: 1rem 0;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.summary-item {
    display: flex;
    flex-direction: column;
}

.summary-item .label {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.summary-item .value {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    margin-top: 0.15rem;
}

/* Map */
#map {
    height: 500px;
    border-radius: 10px;
    margin: 1rem 0;
    z-index: 1;
}

/* Legend */
.legend {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin: 0.5rem 0 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: #aaa;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.dot.vfr { background: #00c853; }
.dot.mvfr { background: #2979ff; }
.dot.ifr { background: #ff1744; }
.dot.lifr { background: #d500f9; }

/* Timeline */
#timeline-container {
    margin: 1.5rem 0;
}

#timeline-container h3,
#weather-table-container h3 {
    font-size: 1rem;
    color: #aaa;
    margin-bottom: 0.75rem;
}

#timeline {
    display: flex;
    height: 32px;
    border-radius: 6px;
    overflow: hidden;
    background: #1a1d27;
}

.timeline-segment {
    height: 100%;
    position: relative;
    cursor: pointer;
    transition: opacity 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.7);
    font-weight: 600;
    min-width: 2px;
}

.timeline-segment:hover {
    opacity: 0.8;
}

.timeline-segment.vfr { background: #00c853; }
.timeline-segment.mvfr { background: #2979ff; }
.timeline-segment.ifr { background: #ff1744; }
.timeline-segment.lifr { background: #d500f9; }
.timeline-segment.unknown { background: #444; }

/* Weather table */
#weather-table-container {
    margin: 1.5rem 0;
    overflow-x: auto;
}

#weather-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

#weather-table th {
    text-align: left;
    padding: 0.6rem 0.75rem;
    color: #888;
    font-weight: 600;
    border-bottom: 1px solid #333;
    white-space: nowrap;
}

#weather-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #1e2130;
    white-space: nowrap;
}

#weather-table tr:hover td {
    background: rgba(74, 158, 255, 0.05);
}

.cat-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.8rem;
    color: #fff;
}

.cat-badge.vfr { background: #00c853; }
.cat-badge.mvfr { background: #2979ff; }
.cat-badge.ifr { background: #ff1744; }
.cat-badge.lifr { background: #d500f9; }
.cat-badge.unknown { background: #666; }

.raw-metar {
    font-family: "SF Mono", Monaco, Consolas, monospace;
    font-size: 0.75rem;
    color: #aaa;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: help;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 1rem;
    color: #555;
    font-size: 0.8rem;
}

footer a {
    color: #4a9eff;
    text-decoration: none;
}

.upload-hint {
    color: #555;
    font-size: 0.8rem;
    margin-top: 0.3rem;
}

.new-flight-link {
    display: inline-block;
    color: #4a9eff;
    font-size: 0.9rem;
    text-decoration: none;
    margin-bottom: 0.5rem;
}

.new-flight-link:hover {
    text-decoration: underline;
}

/* Flight list for bulk uploads */
.flight-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.flight-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    background: #1a1d27;
    border: 1px solid #333;
    color: #aaa;
    font-size: 0.82rem;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.flight-chip:hover {
    border-color: #4a9eff;
    color: #fff;
}

.flight-chip.active {
    border-color: #4a9eff;
    color: #fff;
    background: rgba(74, 158, 255, 0.12);
}

.flight-chip .chip-cat {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.flight-chip .chip-status {
    font-size: 0.75rem;
    color: #555;
}

.flight-chip.loading-chip {
    opacity: 0.5;
}

.flight-chip.error-chip {
    border-color: #ff3c3c;
    color: #ff6b6b;
}

.hidden {
    display: none !important;
}

/* Leaflet popup styling */
.leaflet-popup-content-wrapper {
    background: #1a1d27;
    color: #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.leaflet-popup-tip {
    background: #1a1d27;
}

.leaflet-popup-content {
    font-size: 0.85rem;
    line-height: 1.5;
}

.leaflet-popup-content strong {
    color: #fff;
}

.leaflet-popup-content .metar-raw {
    font-family: monospace;
    font-size: 0.75rem;
    color: #aaa;
    margin-top: 0.5rem;
    word-break: break-all;
}

@media (max-width: 768px) {
    #map { height: 350px; }
    .summary-card { gap: 1rem; }
    header h1 { font-size: 1.5rem; }
}
