:root {
    color-scheme: dark;
    --background: #07111f;
    --background-secondary: #0b1727;
    --panel: rgba(15, 31, 50, 0.95);
    --panel-secondary: #101f32;
    --panel-border: rgba(143, 180, 214, 0.20);
    --text-primary: #f2f7fb;
    --text-secondary: #a9bacb;
    --text-muted: #7f94a8;
    --accent: #57b8ff;
    --accent-soft: rgba(87, 184, 255, 0.13);
    --success: #45d19b;
    --warning: #f3bd54;
    --danger: #ff6f78;
    --shadow: 0 20px 45px rgba(0, 0, 0, 0.22), 0 2px 8px rgba(0, 0, 0, 0.16);
    --radius-large: 20px;
    --radius-medium: 14px;
    --radius-small: 9px;
    --content-width: 1500px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--background); }
body {
    min-height: 100vh;
    margin: 0;
    color: var(--text-primary);
    background: radial-gradient(circle at 15% 0%, rgba(39, 107, 160, 0.20), transparent 34rem),
                linear-gradient(180deg, var(--background-secondary), var(--background));
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}
button, textarea, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.58; }

.site-header { border-bottom: 1px solid var(--panel-border); background: rgba(7, 17, 31, 0.82); }
.header-content {
    width: min(calc(100% - 32px), var(--content-width));
    margin: 0 auto;
    padding: 26px 0;
    display: flex;
    justify-content: space-between;
    gap: 30px;
}
.eyebrow, .panel-kicker {
    margin: 0 0 5px;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { margin: 0; font-size: clamp(1.75rem, 4vw, 2.8rem); line-height: 1.12; letter-spacing: -0.035em; }
h2 { margin: 0; font-size: clamp(1.2rem, 2.4vw, 1.55rem); }
h3 { margin: 0 0 8px; font-size: 1rem; }
.header-description { max-width: 780px; margin: 10px 0 0; color: var(--text-secondary); }
.service-summary {
    width: min(100%, 390px);
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-medium);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.service-summary__logo {
    width: 88px;
    height: 88px;
    flex: 0 0 88px;
    object-fit: cover;
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    background: #000;
}

.service-summary__content {
    min-width: 0;
}

.service-summary__content strong,
.service-summary__label,
.service-summary__description {
    display: block;
}

.service-summary__label {
    margin-bottom: 4px;
    color: var(--text-muted);
    font-size: 0.76rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.service-summary__content strong {
    line-height: 1.35;
}

.service-summary__description {
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.4;
}

.dashboard { width: min(calc(100% - 32px), var(--content-width)); margin: 24px auto; display: grid; gap: 18px; }
.workspace { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(330px, 0.9fr); gap: 18px; }
.panel {
    padding: 22px;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-large);
    background: var(--panel);
    box-shadow: var(--shadow);
}
.panel-header { margin-bottom: 16px; display: flex; justify-content: space-between; gap: 20px; }
.compact-header { margin-bottom: 12px; }
.map-help, .map-attribution-note, .help-text, .selected-file { color: var(--text-muted); font-size: 0.84rem; }
.map-help { max-width: 360px; margin: 0; text-align: right; }
.map-attribution-note { margin: 9px 0 0; }
.map { width: 100%; height: min(68vh, 720px); min-height: 480px; border-radius: var(--radius-medium); background: #071321; }

.aoi-summary { margin: 0 0 16px; }
.aoi-summary div { padding: 10px 0; border-bottom: 1px solid var(--panel-border); }
.aoi-summary dt { color: var(--text-muted); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; }
.aoi-summary dd { margin: 3px 0 0; font-weight: 600; }
.form-group label { display: block; margin-bottom: 7px; font-weight: 700; }
textarea {
    width: 100%;
    min-height: 210px;
    resize: vertical;
    padding: 13px;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-medium);
    outline: none;
    color: #dbeeff;
    background: #071321;
    font-family: "Cascadia Code", Consolas, monospace;
    font-size: 0.82rem;
    line-height: 1.5;
}
textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.help-text { margin: 7px 0 0; }
.upload-row { margin-top: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
#geojson-file { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.file-button, .primary-button, .secondary-button {
    min-height: 42px;
    padding: 9px 14px;
    border-radius: var(--radius-small);
    font-weight: 700;
}
.file-button { display: inline-flex; align-items: center; border: 1px solid var(--accent); background: var(--accent-soft); cursor: pointer; }
.primary-button { border: 1px solid var(--accent); color: #03111c; background: var(--accent); }
.secondary-button { border: 1px solid var(--panel-border); color: var(--text-primary); background: rgba(255, 255, 255, 0.035); }
.button-grid { margin-top: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.button-grid .primary-button { grid-column: 1 / -1; }

.status-panel {
    min-height: 82px;
    padding: 17px 21px;
    display: flex;
    align-items: center;
    gap: 15px;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-medium);
    background: rgba(10, 24, 40, 0.92);
}
.status-panel p { margin: 3px 0 0; color: var(--text-secondary); }
.status-indicator { width: 13px; height: 13px; flex: 0 0 auto; border-radius: 50%; box-shadow: 0 0 0 6px rgba(255,255,255,.04); }
.status-idle { background: var(--text-muted); }
.status-loading { background: var(--warning); animation: pulse 1.25s infinite; }
.status-success { background: var(--success); }
.status-error { background: var(--danger); }
@keyframes pulse { 50% { opacity: .45; transform: scale(.82); } }

.result-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, .72fr); gap: 20px; }
.image-card {
    min-height: 400px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-medium);
    background: #050d17;
}

.satellite-image-stage {
    position: relative;
    width: 100%;
    line-height: 0;
}

.satellite-image-stage img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 78vh;
    object-fit: contain;
}

.aoi-image-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
}

.aoi-image-overlay__shape {
    fill: rgba(255, 193, 7, 0.18);
    stroke: #ffd45c;
    stroke-width: 5;
    vector-effect: non-scaling-stroke;
    stroke-linejoin: round;
}

.aoi-image-overlay__halo {
    fill: none;
    stroke: rgba(0, 0, 0, 0.82);
    stroke-width: 9;
    vector-effect: non-scaling-stroke;
    stroke-linejoin: round;
}

.image-overlay-note {
    margin: 0;
    padding: 10px 14px;
    color: var(--text-secondary);
    background: rgba(10, 24, 40, 0.94);
    border-top: 1px solid var(--panel-border);
    font-size: 0.84rem;
    line-height: 1.4;
}
.metadata-card { padding: 20px; border: 1px solid var(--panel-border); border-radius: var(--radius-medium); background: var(--panel-secondary); }
.metadata-list { margin: 0; }
.metadata-list div { padding: 11px 0; border-bottom: 1px solid var(--panel-border); }
.metadata-list div:last-child { border-bottom: 0; }
.metadata-list dt { color: var(--text-muted); font-size: .76rem; font-weight: 700; text-transform: uppercase; }
.metadata-list dd { margin: 3px 0 0; font-weight: 600; }
.date-badge { padding: 7px 11px; border: 1px solid rgba(69, 209, 155, .25); border-radius: 999px; color: var(--success); background: rgba(69, 209, 155, .08); font-size: .84rem; font-weight: 700; }
.is-hidden { display: none; }
.site-footer { width: min(calc(100% - 32px), var(--content-width)); margin: 0 auto; padding: 0 0 30px; }
.site-footer a { color: var(--accent); }

.leaflet-container { font-family: inherit; }
.leaflet-bar a { color: #111; }

@media (max-width: 1000px) {
    .workspace, .result-grid { grid-template-columns: 1fr; }
    .map { height: 58vh; min-height: 420px; }
}
@media (max-width: 650px) {
    .header-content { flex-direction: column; }
    .service-summary { width: 100%; }
    .service-summary__logo { width: 76px; height: 76px; flex-basis: 76px; }
    .dashboard, .header-content, .site-footer { width: min(calc(100% - 20px), var(--content-width)); }
    .panel { padding: 16px; border-radius: 15px; }
    .panel-header { flex-direction: column; }
    .map-help { max-width: none; text-align: left; }
    .map { min-height: 360px; }
    .button-grid { grid-template-columns: 1fr; }
    .button-grid .primary-button { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}


/* Sökfilter för satellitscener */
.search-settings {
    margin: 18px 0;
    padding: 16px;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-medium);
    background: rgba(255, 255, 255, 0.025);
}

.search-settings > label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
}

.number-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.number-input-row input {
    width: 110px;
    min-height: 44px;
    padding: 9px 12px;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-small);
    outline: none;
    color: var(--text-primary);
    background: #071321;
}

.number-input-row input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.number-input-row span {
    color: var(--text-secondary);
    font-weight: 700;
}

.search-settings select {
    width: 100%;
    margin-top: 7px;
    padding: 10px 12px;
    color: var(--text-primary);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-small);
    background: var(--background-secondary);
}

/* Progressindikator för större AOI-/ZIP-nedladdningar */
.zip-progress-panel {
    padding: 16px 20px;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-medium);
    background: rgba(10, 24, 40, 0.96);
}

.zip-progress-panel.is-hidden {
    display: none;
}

.zip-progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.zip-progress-title {
    font-weight: 700;
}

.zip-progress-time {
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    font-size: 0.88rem;
}

.zip-progress-track {
    position: relative;
    height: 10px;
    margin-top: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
}

.zip-progress-bar {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    transition: width 180ms ease;
}

.zip-progress-bar.is-indeterminate {
    width: 35%;
    animation: zip-progress-indeterminate 1.25s ease-in-out infinite;
}

.zip-progress-message {
    margin: 9px 0 0;
    color: var(--text-secondary);
    font-size: 0.88rem;
}

@keyframes zip-progress-indeterminate {
    0% {
        transform: translateX(-120%);
    }

    100% {
        transform: translateX(360%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .zip-progress-bar.is-indeterminate {
        width: 100%;
        animation: none;
        opacity: 0.55;
    }
}

