/*
   Stations running dry page styles.
   Uses the FuelRadar design system with status accents for availability flags.
*/

/* ── Design Tokens ──────────────────────────────────────────── */
:root {
    /* Critical/unavailable tier must read as error, NOT brand blue — otherwise
       the worst outage state renders as reassuring blue. */
    --outage-red: var(--color-error);
    --outage-red-glow: color-mix(in oklab, var(--color-error) 16%, transparent);
    --outage-amber: var(--color-warning);
    --outage-amber-glow: color-mix(in oklab, var(--color-warning) 18%, transparent);
    --outage-green: var(--color-success);
    --outage-surface: color-mix(in oklab, var(--color-base-200) 55%, transparent);
}

/* ── Live Status Dot (used by the availability bulletin header) ── */
.outage-live-dot {
    width: 8px;
    height: 8px;
    background: var(--outage-red);
    border-radius: 50%;
    animation: outage-pulse 2s ease-in-out infinite;
    box-shadow: 0 0 6px var(--outage-red);
}

@keyframes outage-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.8); }
}

/* ── Interactive Map ───────────────────────────────────────── */
.outage-interactive-map-wrap {
    position: relative;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid var(--color-line);
    background: var(--color-card);
}

.outage-interactive-map {
    width: 100%;
    height: 500px;
}

@media (max-width: 768px) {
    .outage-interactive-map { height: 380px; }
}

.outage-map-badge {
    position: absolute;
    top: 3.5rem;
    left: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 0.5rem;
    background: color-mix(in oklch, var(--color-neutral) 85%, transparent);
    backdrop-filter: blur(8px);
    color: var(--color-error);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    z-index: 5;
    border: 1px solid color-mix(in oklch, var(--color-error) 30%, transparent);
}

/* ── Map Overlay Controls ──────────────────────────────────── */
.outage-map-controls {
    position: absolute;
    bottom: 0.75rem;
    left: 0.75rem;
    display: flex;
    gap: 0.4rem;
    z-index: 5;
}

.outage-map-select {
    appearance: none;
    padding: 0.4rem 1.8rem 0.4rem 0.6rem;
    border-radius: 0.5rem;
    border: 1px solid color-mix(in oklch, var(--color-neutral-content) 15%, transparent);
    background: color-mix(in oklch, var(--color-neutral) 85%, transparent) right 0.5rem center no-repeat;
    backdrop-filter: blur(8px);
    color: var(--color-neutral-content);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s;
    min-width: 100px;
}

.outage-map-select:hover,
.outage-map-select:focus {
    border-color: color-mix(in oklch, var(--color-error) 50%, transparent);
    outline: none;
}

.outage-map-select option {
    background: var(--color-neutral);
    color: var(--color-neutral-content);
}

/* ── Map Search Overlay ───────────────────────────────────── */
.outage-map-search-overlay {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    right: 3.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    z-index: 10;
    max-width: 380px;
}

.outage-map-search-input {
    flex: 1;
    min-width: 0;
    background: color-mix(in oklch, var(--color-neutral) 88%, transparent);
    backdrop-filter: blur(12px);
    border-radius: 0.6rem;
    border: 1px solid color-mix(in oklch, var(--color-neutral-content) 12%, transparent);
    overflow: visible;
    position: relative;
}

.outage-map-search-input .relative {
    position: relative;
}

.outage-map-search-input input {
    color: var(--color-neutral-content) !important;
    font-size: 0.8rem !important;
    padding: 0.45rem 0.5rem !important;
}

.outage-map-search-input input::placeholder {
    color: color-mix(in oklch, var(--color-neutral-content) 40%, transparent) !important;
}

/* Override the GlobalSearch dropdown to work within the map context */
.outage-map-search-input .absolute {
    z-index: 20 !important;
}

.outage-map-locate-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid color-mix(in oklch, var(--color-neutral-content) 12%, transparent);
    border-radius: 0.6rem;
    background: color-mix(in oklch, var(--color-neutral) 88%, transparent);
    backdrop-filter: blur(12px);
    color: var(--color-neutral-content);
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.outage-map-locate-btn:hover {
    border-color: color-mix(in oklch, var(--color-primary) 50%, transparent);
    color: var(--color-primary);
    background: color-mix(in oklch, var(--color-neutral) 95%, transparent);
}

.outage-map-locate-btn:focus-visible,
.outage-filter-btn:focus-visible,
.outage-view-btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.outage-map-locate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

@media (max-width: 768px) {
    .outage-map-search-overlay {
        right: 2.75rem;
        max-width: none;
    }
}

.outage-interactive-map-wrap .maplibregl-popup-content {
    border-radius: 0.75rem !important;
    padding: 1rem !important;
    box-shadow: 0 8px 30px color-mix(in oklch, var(--color-base-content) 20%, transparent) !important;
}

.outage-interactive-map-wrap .maplibregl-popup-close-button {
    top: 6px !important;
    right: 8px !important;
    font-size: 18px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--color-muted);
    transition: background 0.15s;
}

.outage-interactive-map-wrap .maplibregl-popup-close-button:hover {
    background: color-mix(in oklch, var(--color-base-content) 8%, transparent);
    color: var(--color-base-content);
}

/* ── State Grid ────────────────────────────────────────────── */
.outage-state-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.75rem;
}

.outage-station-card.active {
    border-color: var(--color-primary) !important;
    background: color-mix(in oklab, var(--color-primary) 8%, var(--color-card)) !important;
}

/* ── Filter Bar ─────────────────────────────────────────────── */
.outage-filters {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.outage-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--color-line);
    background: var(--color-card);
    color: var(--color-muted);
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
    white-space: nowrap;
}

.outage-filter-btn:hover {
    border-color: color-mix(in oklab, var(--color-primary) 45%, var(--color-line));
    background: var(--color-base-100);
    color: var(--color-primary);
}

.outage-filter-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-primary-content);
    box-shadow: none;
}

.outage-filter-btn .filter-count {
    background: color-mix(in oklch, var(--color-primary-content) 20%, transparent);
    padding: 0.1rem 0.4rem;
    border-radius: 0.375rem;
    font-size: 0.65rem;
    font-weight: 800;
}

/* ── Station List ───────────────────────────────────────────── */
.outage-station-card {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    padding: 1rem;
    background: var(--color-card);
    border: 1px solid var(--color-line);
    border-radius: 0.5rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.outage-station-card:hover {
    border-color: color-mix(in oklab, var(--color-primary) 45%, var(--color-line));
    box-shadow: none;
}

.outage-station-logo {
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    object-fit: contain;
    background: var(--color-base-200);
    flex-shrink: 0;
}

.outage-station-info {
    flex: 1;
    min-width: 0;
}

.outage-station-name {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--color-base-content);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.outage-station-address {
    font-size: 0.75rem;
    color: var(--color-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 0.15rem;
}

.outage-reason {
    font-size: 0.65rem;
    color: var(--color-muted);
    font-style: italic;
    margin-top: 0.25rem;
}

/* ── Responsive ─────────────────────────────────────────────── */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    .outage-filters {
        gap: 0.4rem;
    }

    .outage-filter-btn {
        padding: 0.35rem 0.7rem;
        font-size: 0.7rem;
    }
}

/* ── Pagination ─────────────────────────────────────────────── */
.outage-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 1.5rem;
}

/* ── Section Structure ──────────────────────────────────────── */
.outage-section {
    max-width: 82rem;
    margin: 0 auto;
    padding: 1.75rem 1rem;
}

@media (min-width: 640px) {
    .outage-section {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .outage-section {
        padding: 2.25rem 2rem;
    }
}

.outage-section-label {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--color-muted);
    margin-bottom: 0.5rem;
}

.outage-section-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-base-content);
    margin-bottom: 1.5rem;
}

.outage-view-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem;
    border-radius: 0.5rem;
    border: 1px solid var(--color-line);
    background: var(--color-card);
}

.outage-view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 0.375rem;
    background: transparent;
    color: var(--color-muted);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.outage-view-btn:hover {
    background: var(--color-base-200);
    color: var(--color-primary);
}

.outage-view-btn.active {
    background: var(--color-primary);
    color: var(--color-primary-content);
}
