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

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

.navbar {
    background: #16213e;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #0f3460;
}

.nav-brand {
    color: #e94560;
    font-size: 18px;
    font-weight: 700;
    text-decoration: none;
}

.nav-links a {
    color: #a0a0b0;
    text-decoration: none;
    margin-left: 20px;
}

.nav-links a:hover { color: #fff; }

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 24px;
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    color: #fff;
    margin-bottom: 4px;
}

.card {
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
}

.card h2 {
    color: #e94560;
    font-size: 16px;
    margin-bottom: 12px;
}

.form-row {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    flex-wrap: wrap;
}

input[type="text"], select, textarea {
    background: #1a1a2e;
    border: 1px solid #0f3460;
    color: #e0e0e0;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    flex: 1;
    min-width: 150px;
}

textarea { resize: vertical; width: 100%; flex-basis: 100%; }

.btn {
    background: #0f3460;
    color: #e0e0e0;
    border: 1px solid #0f3460;
    padding: 8px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    white-space: nowrap;
}

.btn:hover { background: #1a4a7a; }

.btn-primary {
    background: #e94560;
    border-color: #e94560;
    color: #fff;
}

.btn-primary:hover { background: #c73650; }

.btn-danger {
    background: #b71c1c;
    border-color: #b71c1c;
    color: #fff;
}

.btn-danger:hover { background: #d32f2f; }

.btn-reanalyze {
    background: #e65100;
    border-color: #e65100;
    color: #fff;
}

.btn-reanalyze:hover { background: #ff6d00; }

.drop-zone {
    border: 2px dashed #0f3460;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: #e94560;
}

.muted { color: #666; font-size: 13px; margin-top: 4px; }

.progress-bar {
    background: #1a1a2e;
    border-radius: 4px;
    height: 8px;
    margin-top: 12px;
    overflow: hidden;
}

.progress-fill {
    background: linear-gradient(90deg, #e94560, #ff6b6b);
    height: 100%;
    width: 0%;
    transition: width 0.3s;
    border-radius: 4px;
}

.status {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-created { background: #0f3460; color: #7bb3ff; }
.status-uploading { background: #1a4a7a; color: #9dd3ff; }
.status-preprocessing { background: #3d2c6e; color: #c4a1ff; }
.status-processing { background: #6e4b00; color: #ffc857; }
.status-completed { background: #1b5e20; color: #81c784; }
.status-failed { background: #5e1b1b; color: #e57373; }
.status-canceled { background: #5e4b1b; color: #ffb74d; }

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.project-card {
    display: block;
    background: #1a1a2e;
    border: 1px solid #0f3460;
    border-radius: 6px;
    padding: 16px;
    text-decoration: none;
    color: #e0e0e0;
    transition: border-color 0.2s;
}

.project-card:hover { border-color: #e94560; }

.project-name { font-weight: 600; margin-bottom: 8px; }

.project-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #888;
}

.image-list {
    margin-top: 12px;
    font-size: 13px;
}

.image-list .image-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid #0f3460;
}

.error {
    background: #5e1b1b;
    color: #e57373;
    padding: 12px;
    border-radius: 4px;
    margin-top: 12px;
}

.results-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

/* ── Map-centric layout ── */

.map-container {
    position: relative;
    height: calc(100vh - 49px);
    width: 100%;
}

/* Smooth high-quality rendering for thermal canvas */
.map-container canvas {
    image-rendering: auto;
}
.map-container .leaflet-tile {
    image-rendering: auto;
}

.sidebar-panel {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 300px;
    z-index: 1000;
    background: rgba(22, 33, 62, 0.94);
    border: 1px solid #0f3460;
    border-radius: 8px;
    padding: 16px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    color: #e0e0e0;
}

.sidebar-panel::-webkit-scrollbar {
    width: 4px;
}

.sidebar-panel::-webkit-scrollbar-thumb {
    background: #0f3460;
    border-radius: 2px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 8px;
}

.sidebar-header h2 {
    color: #fff;
    font-size: 15px;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.sidebar-section {
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(15, 52, 96, 0.6);
}

.sidebar-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.sidebar-section h3 {
    color: #e94560;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.sidebar-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-form select {
    width: 100%;
    flex: unset;
    min-width: unset;
    font-size: 13px;
    padding: 6px 8px;
}

.sidebar-form .btn {
    width: 100%;
    margin-top: 2px;
}

.sidebar-section textarea {
    width: 100%;
    flex: unset;
    font-size: 12px;
    padding: 6px 8px;
    margin-bottom: 6px;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.drop-zone-compact {
    border: 2px dashed #0f3460;
    border-radius: 6px;
    padding: 16px 10px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
    font-size: 13px;
}

.drop-zone-compact:hover,
.drop-zone-compact.dragover {
    border-color: #e94560;
}

.drop-zone-compact p {
    margin: 2px 0;
}

.image-count-badge {
    background: #0f3460;
    color: #7bb3ff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    margin-top: 8px;
    text-align: center;
}

.image-count-badge span {
    color: #fff;
    font-size: 15px;
}

.download-btn {
    width: 100%;
    margin-bottom: 10px;
}

.stats-inline {
    font-size: 12px;
}

.stats-inline .stat-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    border-bottom: 1px solid rgba(15, 52, 96, 0.4);
}

.stats-inline .stat-row:last-child {
    border-bottom: none;
}

.layer-control-panel {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    background: rgba(22, 33, 62, 0.94);
    border: 1px solid #0f3460;
    border-radius: 8px;
    padding: 12px 16px;
    color: #e0e0e0;
    font-size: 13px;
    min-width: 200px;
}

.layer-control-panel h3 {
    color: #e94560;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 10px 0;
}

.layer-control-panel label {
    display: block;
    margin: 6px 0;
    cursor: pointer;
}

.layer-control-panel input[type="radio"],
.layer-control-panel input[type="checkbox"] {
    margin-right: 6px;
    vertical-align: middle;
}

.layer-control-panel hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    margin: 10px 0;
}

.layer-control-panel .slider-group {
    margin-top: 10px;
}

.layer-control-panel .slider-group > label {
    margin-bottom: 4px;
    font-size: 12px;
    color: #a0a0b0;
}

.layer-control-panel .slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.layer-control-panel .slider-row input[type="range"] {
    flex: 1;
    accent-color: #e94560;
}

.layer-control-panel .slider-row span {
    min-width: 36px;
    text-align: right;
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 12px;
}

.temp-readout-bar {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 8px 18px;
    border-radius: 6px;
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 14px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(4px);
}

.temp-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(255,255,255,0.3);
    flex-shrink: 0;
}

.temp-value {
    font-weight: 700;
    font-size: 15px;
    min-width: 72px;
}

.temp-sep {
    color: rgba(255,255,255,0.25);
    font-weight: 300;
}

.temp-coords {
    color: rgba(255,255,255,0.7);
    font-size: 12px;
}

.cursor-tooltip {
    position: fixed;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.88);
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 13px;
    font-weight: 600;
    pointer-events: none;
    display: none;
    white-space: nowrap;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.1);
}

.progress-bar-lg {
    height: 18px;
    margin-top: 8px;
    border-radius: 9px;
    border: 1px solid #0f3460;
}

.progress-bar-lg .progress-fill {
    border-radius: 9px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.process-stage {
    font-size: 14px;
    font-weight: 600;
    color: #ffc857;
    text-transform: uppercase;
}

.process-pct {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    font-family: 'SF Mono', 'Consolas', monospace;
}

.progress-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 13px;
    color: #888;
}

/* Phase checklist */
.phase-checklist {
    list-style: none;
    padding: 0;
    margin: 12px 0 0 0;
    font-size: 13px;
}
.phase-checklist li {
    padding: 4px 0;
    color: #666;
    display: flex;
    align-items: center;
    gap: 8px;
}
.phase-checklist li.phase-done {
    color: #81c784;
}
.phase-checklist li.phase-active {
    color: #fff;
    font-weight: 600;
}
.phase-checklist li.phase-pending {
    color: #555;
}
.phase-icon {
    display: inline-block;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}
.phase-done .phase-icon::after {
    content: '\2714';
    color: #81c784;
}
.phase-active .phase-icon::after {
    content: '\2026';
    animation: pulseDots 1.2s infinite;
    color: #64b5f6;
    font-weight: bold;
}
.phase-pending .phase-icon::after {
    content: '\2013';
    color: #444;
}
@keyframes pulseDots {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}
.flight-arrow {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
}
