/* AeroWeather — base styles */

:root {
    --color-bg: #0a0e17;
    --color-surface: #141a2a;
    --color-text: #e0e6f0;
    --color-text-muted: #8892a4;
    --color-accent: #3b82f6;
    --color-accent-hover: #60a5fa;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-success: #22c55e;
    --radius: 8px;
}

/* ─── Validation flash ────────────────────────────────── */
.input-error {
    outline: 2px solid var(--color-danger) !important;
    outline-offset: -1px;
    animation: error-pulse 0.4s ease;
}
@keyframes error-pulse {
    0%, 100% { outline-color: var(--color-danger); }
    50% { outline-color: transparent; }
}

/* Validation tooltip */
.validation-tooltip {
    position: absolute;
    background: var(--color-danger);
    color: #fff;
    font-size: 0.78rem;
    padding: 6px 12px;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    animation: tooltip-fade 6s ease forwards;
}
.validation-tooltip::after {
    content: "";
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 6px 6px 6px;
    border-style: solid;
    border-color: transparent transparent var(--color-danger) transparent;
}
@keyframes tooltip-fade {
    0%   { opacity: 0; transform: translateY(4px); }
    5%   { opacity: 1; transform: translateY(0); }
    90%  { opacity: 1; }
    100% { opacity: 0; }
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header nav {
    display: flex;
    align-items: center;
    padding: 0.6rem 2rem;
    background: var(--color-surface);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    gap: 0.5rem;
}

.brand-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.site-logo {
    height: 40px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
}

.brand-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-accent);
    text-decoration: none;
    white-space: nowrap;
}

/* ─── Nav controls (chart page header bar) ───────────── */
.nav-controls {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1;
    flex-wrap: wrap;
    margin-left: 0.5rem;
}

.nav-controls .header-route {
    flex: 1;
    min-width: 120px;
    max-width: 260px;
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
    font-family: monospace;
    text-transform: uppercase;
    background: var(--color-bg);
    color: var(--color-text);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: var(--radius);
}

.nav-controls .header-route::placeholder {
    text-transform: none;
    font-family: sans-serif;
    color: var(--color-text-muted);
}

.nav-controls .header-select {
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
    background: var(--color-bg);
    color: var(--color-text);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: var(--radius);
}

.nav-controls .header-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-controls .header-group label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.nav-controls input[type="number"] {
    width: 55px;
    padding: 0.3rem 0.4rem;
    font-size: 0.8rem;
    font-family: monospace;
    background: var(--color-bg);
    color: var(--color-text);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: var(--radius);
}

.nav-controls input[type="date"] {
    padding: 0.3rem 0.4rem;
    font-size: 0.8rem;
    background: var(--color-bg);
    color: var(--color-text);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: var(--radius);
    color-scheme: dark;
}

.nav-controls .time-input {
    width: 70px;
    padding: 0.3rem 0.4rem;
    font-size: 0.8rem;
}

.nav-controls .refresh-btn {
    padding: 0.3rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--color-accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.nav-controls .refresh-btn:hover {
    background: var(--color-accent-hover);
}

.nav-controls .refresh-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ─── Share button & popup ────────────────────────────── */
/* ── Key button & panel ─────────────────────────────────── */
/* ── Legend slide-out ── */
.legend-btn {
    padding: 0.3rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.legend-btn:hover,
.legend-btn.open {
    color: var(--color-text);
    border-color: rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.05);
}

.legend-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.legend-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.legend-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 280px;
    max-width: 85vw;
    background: var(--color-surface);
    border-left: 1px solid rgba(255,255,255,0.12);
    box-shadow: -4px 0 24px rgba(0,0,0,0.5);
    z-index: 999;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.25s ease;
}
.legend-panel.open {
    transform: translateX(0);
}

.legend-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}
.legend-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-text);
}
.legend-close {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0 0.2rem;
    line-height: 1;
    transition: color 0.15s;
}
.legend-close:hover {
    color: var(--color-text);
}

.legend-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.4rem 0 1rem;
}

.legend-section-title {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--color-accent);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.6rem 1rem 0.2rem;
}
.legend-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--color-accent);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.6rem 1rem 0.2rem;
    cursor: pointer;
}
.legend-section-header input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--color-accent);
    cursor: pointer;
    flex-shrink: 0;
}

.legend-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.3rem 1rem;
    font-size: 0.8rem;
    color: var(--color-text);
    cursor: default;
    transition: background 0.12s;
}
.legend-row:hover {
    background: rgba(255,255,255,0.04);
}

.legend-row input[type="checkbox"] {
    margin-left: auto;
    width: 16px;
    height: 16px;
    accent-color: var(--color-accent);
    cursor: pointer;
    flex-shrink: 0;
}

.legend-swatch {
    display: inline-block;
    width: 22px;
    height: 14px;
    border-radius: 2px;
    flex-shrink: 0;
}
.legend-swatch.narrow {
    width: 6px;
    border-radius: 1px;
}

.legend-line {
    display: inline-block;
    width: 22px;
    height: 0;
    flex-shrink: 0;
}

.legend-glyph {
    display: inline-block;
    width: 22px;
    flex-shrink: 0;
    text-align: center;
    font-size: 16px;
    line-height: 1;
}

.legend-spacer {
    display: inline-block;
    width: 22px;
    flex-shrink: 0;
}

.legend-label {
    flex: 1;
    min-width: 0;
}

.sub-toggle {
    opacity: 0.7;
    font-size: 0.75rem;
    cursor: pointer;
}
.sub-toggle input[type="checkbox"] {
    margin-left: auto;
    width: 15px;
    height: 15px;
    accent-color: var(--color-accent);
    cursor: pointer;
    flex-shrink: 0;
}

.share-wrapper {
    position: relative;
    margin-left: auto;  /* push to far right */
}

.share-btn {
    padding: 0.3rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.share-btn:hover {
    color: var(--color-text);
    border-color: rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.05);
}

.share-popup {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--color-surface);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: var(--radius);
    padding: 0.4rem;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    white-space: nowrap;
}

.share-url {
    width: 240px;
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
    font-family: monospace;
    background: rgba(255,255,255,0.06);
    color: var(--color-text);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 4px;
    outline: none;
}
.share-url:focus {
    border-color: var(--color-accent);
}

.share-copy-btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--color-accent);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}
.share-copy-btn:hover {
    background: var(--color-accent-hover);
}

main {
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Chart display needs full viewport width, minimal padding */
main:has(.chart-page) {
    max-width: 100%;
    padding: 0.25rem 0.5rem;
}

footer {
    padding: 0.5rem 2rem;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.hero {
    text-align: center;
    padding: 4rem 0;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.hero-logo {
    height: 6rem;
    width: auto;
    max-width: 80%;
    object-fit: contain;
    margin-bottom: 0.5rem;
}

.hero p {
    color: var(--color-text-muted);
    margin-bottom: 2rem;
}

/* ─── Screen-reader-only utility ─────────────────────── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}

/* ─── Route form (index page) ────────────────────────── */
.route-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    max-width: 600px;
    margin: 0 auto;
}

.form-row {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

.form-row input[type="text"] {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius);
    font-family: monospace;
    text-transform: uppercase;
}

.form-row input::placeholder {
    color: var(--color-text-muted);
    text-transform: none;
    font-family: sans-serif;
}

.form-row button,
.route-form button {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    background: var(--color-accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
    white-space: nowrap;
}

.form-row button:hover,
.route-form button:hover {
    background: var(--color-accent-hover);
}

.form-row button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ─── Form options row ───────────────────────────────── */
.form-options {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    justify-content: center;
}

.option-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.option-group label {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.option-group select,
.option-group input[type="number"] {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius);
    min-width: 70px;
}

.option-group input[type="number"] {
    width: 80px;
    font-family: monospace;
}

.option-group input[type="date"] {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius);
    color-scheme: dark;
}

/* ─── Time text input (24hr HH:MM) ──────────────────── */
.time-input {
    width: 75px;
    padding: 0.4rem 0.5rem;
    font-size: 0.85rem;
    font-family: monospace;
    text-align: center;
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius);
}

.time-input::placeholder {
    font-family: sans-serif;
    color: var(--color-text-muted);
}

/* ─── Now button & Zulu toggle ──────────────────────── */
.route-form button.now-btn,
button.now-btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.route-form button.now-btn:hover,
button.now-btn:hover {
    background: rgba(255,255,255,0.08);
    color: var(--color-text);
    border-color: rgba(255,255,255,0.3);
}

.zulu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-muted);
    cursor: pointer;
    user-select: none;
    padding: 0.3rem 0.4rem;
    border-radius: var(--radius);
    transition: color 0.2s, background 0.2s;
}

.zulu-toggle:hover {
    color: var(--color-text);
}

.zulu-toggle input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--color-accent);
    cursor: pointer;
}

.zulu-toggle input[type="checkbox"]:checked + span,
.zulu-toggle:has(input:checked) {
    color: var(--color-accent);
}

/* ─── Chart container ────────────────────────────────── */
.chart-container {
    margin-top: 0.5rem;
    text-align: center;
}

.chart-wrapper {
    background: var(--color-surface);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: var(--radius);
    padding: 0.5rem;
    overflow-x: auto;
}

.chart-wrapper img {
    height: calc(100vh - 140px);
    width: auto;
    display: block;
    max-width: none;  /* Allow image to exceed container width */
}

/* ─── Loading spinner ────────────────────────────────── */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 3rem 0;
    color: var(--color-text-muted);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ─── Error message ──────────────────────────────────── */
.error-message {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.3);
    color: var(--color-danger);
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    text-align: center;
    margin: 1rem 0;
}

/* ─── Chart page ─────────────────────────────────────── */
.chart-page {
    max-width: 100%;
}

/* ─── Slider popups (FL & Speed) ─────────────────────── */
.slider-popup {
    position: absolute;
    z-index: 1000;
    width: 340px;
    background: var(--color-surface);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius);
    padding: 0.5rem 1rem 0.6rem;
    box-shadow: 0 6px 24px rgba(0,0,0,0.55);
}

.slider-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.15rem;
}

.slider-popup-title {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.slider-close {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0 0.15rem;
    line-height: 1;
    transition: color 0.15s;
}

.slider-close:hover {
    color: var(--color-text);
}

.slider-value {
    text-align: center;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 0.15rem 0 0.3rem;
    font-family: monospace;
}

/* Range slider track + thumb */
.popup-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    /* track fill set via JS linear-gradient */
    background: rgba(255,255,255,0.08);
}

.popup-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-accent);
    border: 2px solid var(--color-accent-hover);
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.popup-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-accent);
    border: 2px solid var(--color-accent-hover);
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.25rem;
    font-size: 0.65rem;
    color: var(--color-text-muted);
    font-family: monospace;
}

/* KTAS / Mach toggle */
.speed-toggle {
    display: flex;
    margin-bottom: 0.3rem;
    border-radius: var(--radius);
    overflow: hidden;
}

.speed-toggle button {
    flex: 1;
    padding: 0.25rem 0;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--color-bg);
    color: var(--color-text-muted);
    border: 1px solid rgba(255,255,255,0.12);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.speed-toggle button:first-child {
    border-right: none;
    border-radius: var(--radius) 0 0 var(--radius);
}

.speed-toggle button:last-child {
    border-radius: 0 var(--radius) var(--radius) 0;
}

.speed-toggle button.active {
    background: var(--color-accent);
    color: white;
    border-color: var(--color-accent);
}

/* ─── Options dropdown ──────────────────────────────── */
.options-dropdown {
    position: relative;
}

.options-toggle {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 600;
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.options-toggle:hover,
.options-toggle.open {
    background: rgba(255,255,255,0.08);
    color: var(--color-text);
}

.options-panel {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 900;
    min-width: 180px;
    background: var(--color-surface);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius);
    padding: 0.4rem 0;
    box-shadow: 0 6px 24px rgba(0,0,0,0.55);
}

.options-panel.open {
    display: block;
}

.options-panel label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    color: var(--color-text);
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}

.options-panel label:hover {
    background: rgba(255,255,255,0.06);
}

.options-panel input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--color-accent);
    cursor: pointer;
}

/* Index page: position within form-options row */
.route-form .options-dropdown {
    margin-left: auto;
}

.route-form .options-toggle {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
}

.route-form .options-panel {
    right: auto;
    left: 0;
}

/* ─── Responsive ─────────────────────────────────────── */
@media (max-width: 640px) {
    main {
        padding: 1rem;
    }

    header nav {
        padding: 0.5rem 1rem;
        flex-wrap: wrap;
    }

    .hero h1 {
        font-size: 1.75rem;
    }

    .form-row {
        flex-direction: column;
    }

    .form-options {
        flex-direction: column;
        align-items: stretch;
    }

    .option-group {
        justify-content: space-between;
    }

    .nav-controls {
        margin-left: 0;
        gap: 0.4rem;
    }

    .nav-controls .header-route {
        min-width: 100%;
        max-width: none;
    }

    .slider-popup {
        width: calc(100vw - 16px);
        left: 8px !important;
    }
}

/* ═══════════════════════════════════════════════════════════
   Admin page
   ═══════════════════════════════════════════════════════════ */

.admin-page {
    max-width: 900px;
    margin: 0 auto;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.admin-header h1 {
    font-size: 1.75rem;
    margin: 0;
}

.admin-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ── Buttons ── */
.btn {
    padding: 0.45rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--color-accent);
    color: white;
}
.btn-primary:hover:not(:disabled) {
    background: var(--color-accent-hover);
}

.btn-secondary {
    background: rgba(255,255,255,0.08);
    color: var(--color-text-muted);
    border: 1px solid rgba(255,255,255,0.15);
}
.btn-secondary:hover:not(:disabled) {
    background: rgba(255,255,255,0.12);
    color: var(--color-text);
}

.btn-apply {
    background: var(--color-success);
    color: white;
}
.btn-apply:hover:not(:disabled) {
    background: #16a34a;
}

.btn-danger {
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger:hover:not(:disabled) {
    background: rgba(239,68,68,0.1);
    color: var(--color-danger);
    border-color: var(--color-danger);
}

/* ── Status bar ── */
.admin-status {
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}
.status-success {
    background: rgba(34,197,94,0.12);
    color: var(--color-success);
    border: 1px solid rgba(34,197,94,0.3);
}
.status-error {
    background: rgba(239,68,68,0.12);
    color: var(--color-danger);
    border: 1px solid rgba(239,68,68,0.3);
}
.status-info {
    background: rgba(59,130,246,0.12);
    color: var(--color-accent);
    border: 1px solid rgba(59,130,246,0.3);
}

/* ── Section ── */
.admin-section h2 {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}
.section-description {
    color: var(--color-text-muted);
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
}

/* ── Color groups ── */
.color-group {
    margin-bottom: 1.25rem;
    background: var(--color-surface);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius);
    overflow: hidden;
}

.color-group-header {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.6rem 1rem;
    margin: 0;
    cursor: pointer;
    user-select: none;
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    transition: background 0.15s;
}
.color-group-header:hover {
    background: rgba(255,255,255,0.06);
}
.color-group-header::before {
    content: "▾ ";
    font-size: 0.7em;
    color: var(--color-text-muted);
}
.color-group.collapsed .color-group-header::before {
    content: "▸ ";
}
.color-group.collapsed .color-grid {
    display: none;
}

.color-grid {
    padding: 0.5rem 1rem;
}

/* ── Color row ── */
.color-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.color-row:last-child {
    border-bottom: none;
}

.color-row.has-draft {
    background: rgba(59,130,246,0.06);
    margin: 0 -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
}
.color-row.has-local {
    background: rgba(245,158,11,0.08);
    margin: 0 -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
}

.color-label {
    flex: 1;
    font-size: 0.85rem;
    color: var(--color-text);
    min-width: 180px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.draft-badge {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--color-accent);
    background: rgba(59,130,246,0.15);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
}

.unsaved-badge {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--color-warning);
    background: rgba(245,158,11,0.15);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
}

.color-meta {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    white-space: nowrap;
    min-width: 130px;
}

.color-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Color picker */
.color-picker {
    width: 36px;
    height: 28px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 4px;
    cursor: pointer;
    padding: 0;
    background: none;
}
.color-picker::-webkit-color-swatch-wrapper {
    padding: 2px;
}
.color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 2px;
}

.color-hex {
    width: 80px;
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
    font-family: monospace;
    text-transform: uppercase;
    background: var(--color-bg);
    color: var(--color-text);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 4px;
    text-align: center;
}

/* Alpha controls */
.alpha-slider {
    width: 100px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}
.alpha-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--color-accent);
    cursor: pointer;
}
.alpha-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--color-accent);
    border: none;
    cursor: pointer;
}

.alpha-num {
    width: 60px;
    padding: 0.3rem 0.4rem;
    font-size: 0.8rem;
    font-family: monospace;
    background: var(--color-bg);
    color: var(--color-text);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 4px;
    text-align: center;
}

/* Reset button */
.color-reset-btn {
    padding: 0.2rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.color-reset-btn:hover:not(:disabled) {
    background: rgba(255,255,255,0.06);
    color: var(--color-text);
    border-color: rgba(255,255,255,0.2);
}
.color-reset-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

/* Font select */
.font-select {
    min-width: 160px;
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
    background: var(--color-bg);
    color: var(--color-text);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 4px;
    cursor: pointer;
}
.font-select option {
    background: var(--color-bg);
    color: var(--color-text);
}
.font-preview {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-left: 0.25rem;
    white-space: nowrap;
}

/* Size input */
.size-input {
    width: 60px;
    padding: 0.3rem 0.4rem;
    font-size: 0.8rem;
    font-family: monospace;
    background: var(--color-bg);
    color: var(--color-text);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 4px;
    text-align: center;
}
.size-unit {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-left: 0.15rem;
}

/* Image upload */
.image-upload-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.image-preview {
    width: 48px;
    height: 48px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 4px;
    object-fit: contain;
    background: var(--color-bg);
}
.image-placeholder {
    width: 48px;
    height: 48px;
    border: 1px dashed rgba(255,255,255,0.15);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--color-text-muted);
    background: var(--color-bg);
}
.image-actions {
    display: flex;
    gap: 0.35rem;
}
.btn-upload {
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--color-accent);
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-upload:hover {
    background: var(--color-accent-hover);
}
.btn-remove-img {
    padding: 0.2rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-remove-img:hover {
    background: rgba(239,68,68,0.1);
    color: var(--color-danger);
    border-color: var(--color-danger);
}

/* ── Admin responsive ── */
@media (max-width: 640px) {
    .admin-header {
        flex-direction: column;
        align-items: stretch;
    }
    .admin-actions {
        justify-content: flex-end;
    }
    .color-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
    }
    .color-label {
        min-width: auto;
    }
    .alpha-slider {
        width: 80px;
    }
}
