:root {
    --bg-color: #090d16;
    --card-bg: rgba(30, 41, 59, 0.5);
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #d97706;
    --border: rgba(255, 255, 255, 0.08);
    --card-hover-bg: rgba(30, 41, 59, 0.58);
    --suggestions-bg: #1e293b;
    --list-item-bg: rgba(15, 23, 42, 0.26);
    --list-item-hover-bg: rgba(15, 23, 42, 0.38);
    --list-item-border: rgba(255, 255, 255, 0.045);
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --ambient-glow: rgba(2, 132, 199, 0.13);
}

body.light-mode {
    --bg-color: #f1f5f9;
    --card-bg: rgba(255, 255, 255, 0.78);
    --text-color: #0f172a;
    --text-muted: #475569;
    --accent: #b45309;
    --border: rgba(15, 23, 42, 0.12);
    --card-hover-bg: rgba(255, 255, 255, 0.92);
    --suggestions-bg: #ffffff;
    --list-item-bg: rgba(241, 245, 249, 0.72);
    --list-item-hover-bg: rgba(226, 232, 240, 0.92);
    --list-item-border: rgba(15, 23, 42, 0.06);
    --ambient-glow: rgba(217, 119, 6, 0.12);
}

* {
    box-sizing: border-box;
}

.lucide {
    width: 1em;
    height: 1em;
    stroke-width: 2;
    vertical-align: -0.12em;
}

#status-icon,
.location-button,
.tab-btn,
#theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

#status-icon {
    flex-shrink: 0;
}

body {
    font-family: "Inter", system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    background-image: radial-gradient(rgba(148, 163, 184, 0.04) 0.7px, transparent 0.7px);
    background-size: 30px 30px;
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    transition: background-color 0.3s, color 0.3s;
}

.weather-hero-temperature,
.weather-hero-time,
#update-time,
.weather-hero-location,
#latest-eq,
.list-item strong {
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    font-variant-numeric: tabular-nums;
}

#update-time {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.update-indicator {
    display: inline-flex;
    color: #22c55e;
    animation: updateIndicatorPulse 1.8s ease-in-out infinite;
}

@keyframes updateIndicatorPulse {
    0%, 100% { opacity: 0.45; }
    50% { opacity: 1; }
}

body::before {
    position: fixed;
    inset: -170px -150px auto auto;
    z-index: 0;
    width: min(62vw, 760px);
    height: min(62vw, 760px);
    border-radius: 50%;
    background: radial-gradient(circle, var(--ambient-glow) 0%, transparent 70%);
    content: "";
    pointer-events: none;
}

.container {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
}

body:has(.weather-hero[data-theme="sunny"]) {
    --ambient-glow: rgba(2, 132, 199, 0.2);
}

body:has(.weather-hero[data-theme="cloudy"]),
body:has(.weather-hero[data-theme="rain"]),
body:has(.weather-hero[data-theme="storm"]) {
    --ambient-glow: rgba(59, 130, 246, 0.18);
}

body:has(.weather-hero[data-theme="dawn"]),
body:has(.weather-hero[data-theme="dusk"]) {
    --ambient-glow: rgba(217, 119, 6, 0.18);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 15px;
    gap: 12px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.header-location {
    position: relative;
}

.header-location-status {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 1000;
    width: min(280px, calc(100vw - 40px));
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card-bg);
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.24);
    line-height: 1.4;
    overflow-wrap: anywhere;
    white-space: normal;
}

.header-location-status[hidden],
.weather-hero-location[hidden],
.location-suggestions[hidden] {
    display: none;
}

h1 {
    font-size: 1.4rem;
    margin: 0 0 4px 0;
    color: var(--text-color);
    letter-spacing: -0.035em;
}

.brand-informasi {
    color: var(--text-color);
}

.brand-accent {
    color: var(--accent);
}

.muted-text {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.5;
}

.status-banner {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-left: 3px solid var(--success);
    padding: 14px 20px;
    border-radius: 14px;
    margin-bottom: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 20px rgba(2, 6, 23, 0.1);
}

.status-banner.warning {
    border-left-color: var(--warning);
    background-color: rgba(245, 158, 11, 0.07);
}

.status-banner.danger {
    border-left-color: var(--danger);
    background-color: rgba(239, 68, 68, 0.1);
}

.weather-hero {
    --hero-glow: rgba(2, 132, 199, 0.32);
    --hero-wash: rgba(2, 132, 199, 0.28);
    position: relative;
    isolation: isolate;
    overflow: hidden;
    min-height: 220px;
    margin-bottom: 20px;
    padding: 22px 28px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 22px;
    color: #f8fafc;
    background-color: rgba(30, 41, 59, 0.62);
    background-image:
        radial-gradient(ellipse at 84% 18%, var(--hero-glow), transparent 38%),
        linear-gradient(118deg, var(--hero-wash) 0%, rgba(15, 23, 42, 0.36) 52%, rgba(9, 13, 22, 0.6) 100%);
    box-shadow: 0 14px 34px rgba(2, 6, 23, 0.22);
    transition: border-color 220ms ease;
}

.weather-hero[data-theme="sunny"] {
    --hero-glow: rgba(2, 132, 199, 0.34);
    --hero-wash: rgba(2, 132, 199, 0.3);
}

.weather-hero[data-theme="cloudy"] {
    --hero-glow: rgba(59, 130, 246, 0.28);
    --hero-wash: rgba(59, 130, 246, 0.24);
}

.weather-hero[data-theme="rain"] {
    --hero-glow: rgba(59, 130, 246, 0.32);
    --hero-wash: rgba(59, 130, 246, 0.28);
}

.weather-hero[data-theme="storm"] {
    --hero-glow: rgba(99, 102, 241, 0.34);
    --hero-wash: rgba(59, 130, 246, 0.24);
}

.weather-hero[data-theme="dawn"] {
    --hero-glow: rgba(217, 119, 6, 0.3);
    --hero-wash: rgba(217, 119, 6, 0.24);
}

.weather-hero[data-theme="dusk"] {
    --hero-glow: rgba(217, 119, 6, 0.36);
    --hero-wash: rgba(217, 119, 6, 0.3);
}

.weather-hero[data-theme="night"] {
    --hero-glow: rgba(59, 130, 246, 0.22);
    --hero-wash: rgba(30, 41, 59, 0.24);
}

.weather-hero-content {
    position: relative;
    z-index: 1;
}

.weather-hero-topline,
.weather-hero-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.weather-hero-label,
.weather-hero-source {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.16em;
}

.weather-hero-label {
    color: rgba(248, 250, 252, 0.78);
}

.weather-hero-time {
    color: rgba(248, 250, 252, 0.82);
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}

.weather-hero-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin: 22px 0 18px;
}

.weather-hero-copy {
    min-width: 0;
}

.weather-hero-condition {
    margin: 0 0 5px;
    color: rgba(248, 250, 252, 0.86);
    font-size: 1rem;
    font-weight: 500;
}

.weather-hero-region {
    overflow: hidden;
    margin: 0;
    color: #fff;
    font-size: clamp(1.35rem, 3vw, 2rem);
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.weather-hero-temperature {
    display: flex;
    align-items: flex-start;
    flex-shrink: 0;
    font-size: clamp(3.5rem, 8vw, 5.5rem);
    font-weight: 650;
    letter-spacing: -0.08em;
    line-height: 0.9;
}

.weather-hero-unit {
    margin: 5px 0 0 5px;
    font-size: 1.25rem;
    font-weight: 500;
    letter-spacing: 0;
}

.weather-hero-footer {
    color: rgba(248, 250, 252, 0.72);
    font-size: 0.78rem;
}

.weather-hero-source {
    color: rgba(248, 250, 252, 0.66);
    font-size: 0.62rem;
}

.weather-hero-location {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 100%;
    margin-top: 12px;
    padding: 7px 10px;
    border: 1px solid rgba(248, 250, 252, 0.2);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.18);
    color: rgba(248, 250, 252, 0.9);
    font-size: 0.78rem;
    line-height: 1.35;
}

.weather-hero-location-icon {
    flex-shrink: 0;
    font-size: 1rem;
}

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    body {
        padding: 14px;
    }

    header {
        flex-direction: column;
        align-items: stretch;
    }

    .header-actions {
        align-self: flex-end;
    }

    .weather-hero {
        min-height: 190px;
        padding: 18px;
    }

    .weather-hero-main {
        gap: 12px;
        margin: 20px 0 16px;
    }

    .weather-hero-condition {
        font-size: 0.9rem;
    }

    .weather-hero-temperature {
        font-size: 3.5rem;
    }

    .weather-hero-footer {
        align-items: flex-start;
    }

    .weather-hero-source {
        text-align: right;
    }

    .weather-hero-location {
        align-items: flex-start;
        border-radius: 10px;
        font-size: 0.72rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .status-banner.normal-pulse,
    .status-banner.danger-pulse {
        animation: none !important;
    }
}

.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 22px rgba(2, 6, 23, 0.14);
    transition: border-color 180ms ease, background-color 180ms ease;
}

.card:hover {
    border-color: rgba(217, 119, 6, 0.22);
    background-color: var(--card-hover-bg);
}

.card h2 {
    margin-top: 0;
    font-size: 1.1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
    color: var(--text-color);
    letter-spacing: -0.02em;
}

.card p {
    line-height: 1.55;
}

#map {
    height: 320px;
    border: 1px solid var(--border);
    border-radius: 14px;
    margin-top: 10px;
    z-index: 1;
    box-shadow: 0 8px 18px rgba(2, 6, 23, 0.16);
}

.form-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.location-search-group {
    align-items: flex-start;
}

.location-input-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
}

.location-input-wrap input {
    width: 100%;
}

.location-suggestions {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 20;
    display: grid;
    max-height: 260px;
    overflow-y: auto;
    padding: 5px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background-color: var(--suggestions-bg);
    box-shadow: 0 12px 28px rgba(2, 6, 23, 0.26);
    isolation: isolate;
}

.location-option {
    display: grid;
    gap: 3px;
    width: 100%;
    padding: 9px 10px;
    border-radius: 9px;
    background: transparent;
    color: var(--text-color);
    text-align: left;
    font-weight: 500;
    transition: background-color 180ms ease, color 180ms ease;
}

.location-option:hover,
.location-option:focus-visible {
    background: rgba(217, 119, 6, 0.14);
    color: var(--text-color);
    opacity: 1;
}

.location-option small {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.4;
}

.location-search-status {
    min-height: 1.2em;
    margin: -7px 0 12px;
    font-size: 0.8rem;
}

.location-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    flex-shrink: 0;
    white-space: nowrap;
}

.location-button span:first-child {
    color: var(--accent);
    font-size: 1.2rem;
    line-height: 1;
}

.location-button:disabled {
    cursor: wait;
    opacity: 0.7;
}

.location-button:hover,
.header-actions > .btn-secondary:hover {
    border-color: rgba(217, 119, 6, 0.58);
    background-color: rgba(217, 119, 6, 0.14);
}

input, button {
    padding: 10px 12px;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid var(--border);
    color: var(--text-color);
    border-radius: 10px;
    font-size: 0.95rem;
    transition: background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease, color 180ms ease;
}

input {
    flex: 1;
    color-scheme: dark;
}

input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.18);
}

body.light-mode input {
    background: rgba(255, 255, 255, 0.86);
    color: var(--text-color);
    color-scheme: light;
}

button {
    background: #d97706;
    color: #fff7ed;
    font-weight: 650;
    cursor: pointer;
    border: none;
}

button:hover {
    background: #b45309;
}

button:focus-visible,
input:focus-visible {
    outline: 2px solid #f59e0b;
    outline-offset: 2px;
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border);
    font-weight: 500;
}

.scroll-box {
    max-height: 230px;
    overflow-y: auto;
    scrollbar-color: rgba(148, 163, 184, 0.4) transparent;
    scrollbar-width: thin;
}

.list-item {
    padding: 12px 13px;
    margin-bottom: 7px;
    border: 1px solid var(--list-item-border);
    border-radius: 11px;
    background: var(--list-item-bg);
    font-size: 0.9rem;
    line-height: 1.4;
    transition: border-color 180ms ease, background-color 180ms ease;
}

.list-item:hover {
    border-color: rgba(217, 119, 6, 0.18);
    background: var(--list-item-hover-bg);
}

.error-text {
    color: var(--danger);
    font-weight: 600;
}

footer {
    text-align: center;
    color: var(--text-muted);
    margin-top: 30px;
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    padding-top: 20px;
    line-height: 1.7;
}

footer a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
    transition: color 160ms ease;
}

footer a:hover,
footer a:focus-visible {
    color: var(--text-color);
    text-decoration: underline;
}

/* Loading Screen */
#rockstar-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #090d16;
    color: #f8fafc;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.8s ease-in-out, visibility 0.8s ease-in-out;
}

#rockstar-loader.fade-out {
    opacity: 0;
    visibility: hidden;
}

.loader-content {
    text-align: center;
    width: 320px;
}

.loader-logo {
    font-family: system-ui, -apple-system, sans-serif;
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: 4px;
    margin-bottom: 8px;
    color: #ffffff;
    text-transform: uppercase;
}

.loader-subtitle {
    font-size: 0.75rem;
    letter-spacing: 2px;
    color: #64748b;
    margin-bottom: 24px;
    text-transform: uppercase;
}

.loader-bar-container {
    width: 100%;
    height: 3px;
    background-color: rgba(30, 41, 59, 0.8);
    border-radius: 2px;
    overflow: hidden;
}

#loader-bar {
    width: 0%;
    height: 100%;
    background-color: #d97706;
    transition: width 0.4s ease-out;
    box-shadow: 0 0 12px rgba(217, 119, 6, 0.5);
}

/* --- Animasi Status Banner Interaktif & Berkedip (Pulse) --- */
@keyframes softPulseNormal {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

@keyframes urgentPulseDanger {
    0% {
        background-color: rgba(239, 68, 68, 0.2);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    50% {
        background-color: rgba(239, 68, 68, 0.4);
        box-shadow: 0 0 0 15px rgba(239, 68, 68, 0);
    }
    100% {
        background-color: rgba(239, 68, 68, 0.2);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.status-banner {
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.status-banner.normal-pulse {
    border-left-color: var(--success);
    animation: softPulseNormal 3s infinite;
}

.status-banner.danger-pulse {
    border-left-color: var(--danger);
    animation: urgentPulseDanger 1.2s infinite;
}

/* --- Navigasi Tab Utama --- */
.tab-nav {
    display: flex;
    gap: 12px;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 15px;
}

.tab-btn {
    background: var(--card-bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.tab-btn:hover,
.tab-btn:focus-visible {
    border-color: var(--accent);
    color: var(--text-color);
}

.tab-btn.active {
    background: var(--accent);
    color: #0f172a;
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.24);
}

button {
    transition: transform 140ms ease, background-color 180ms ease, border-color 180ms ease, color 180ms ease;
}

button:active {
    transform: translateY(1px) scale(0.99);
}

.card,
.list-item {
    transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

@media (hover: hover) {
    .card:hover {
        transform: translateY(-2px);
    }
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeInTab 180ms ease-out;
}

.map-card {
    margin-top: 20px;
}

@keyframes fadeInTab {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px) {
    body {
        padding: 10px;
    }

    header {
        align-items: flex-start;
        margin-bottom: 14px;
        padding-bottom: 12px;
    }

    header > div:first-child {
        min-width: 0;
    }

    h1 {
        font-size: 1.15rem;
        line-height: 1.25;
    }

    .header-actions {
        align-self: stretch;
        width: 100%;
        gap: 6px;
    }

    .header-location {
        flex: 1;
        min-width: 0;
    }

    .header-location-status {
        left: 0;
        right: auto;
        width: min(300px, calc(100vw - 20px));
    }

    .location-button,
    .header-actions > .btn-secondary {
        width: auto;
        min-width: 0;
        padding: 10px 9px;
        font-size: 0.8rem;
    }

    .location-button {
        width: 100%;
    }

    .header-actions > .btn-secondary {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .status-banner {
        margin-bottom: 14px;
        padding: 12px 14px;
        font-size: 0.86rem;
    }

    .tab-nav {
        gap: 8px;
        margin-bottom: 14px;
        overflow-x: auto;
        padding-bottom: 10px;
    }

    .tab-btn {
        flex: 1 0 max-content;
        padding: 10px 14px;
        font-size: 0.82rem;
    }

    .card {
        margin-bottom: 14px;
        padding: 15px;
        border-radius: 14px;
    }

    .card h2 {
        font-size: 1rem;
        padding-bottom: 8px;
    }

    .map-card {
        margin-top: 14px;
    }

    #map {
        height: 245px;
    }

    .form-group,
    .location-search-group {
        flex-direction: column;
        gap: 8px;
    }

    .location-input-wrap,
    .location-search-group button {
        width: 100%;
    }

    input,
    button {
        min-height: 42px;
        font-size: 0.9rem;
    }

    .location-suggestions {
        max-height: 220px;
    }

    .weather-hero {
        min-height: 0;
        margin-bottom: 14px;
        padding: 16px;
        border-radius: 16px;
    }

    .weather-hero-main {
        align-items: flex-start;
        flex-wrap: wrap;
        margin: 18px 0 14px;
    }

    .weather-hero-copy {
        flex: 1 1 170px;
    }

    .weather-hero-region {
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .weather-hero-temperature {
        font-size: clamp(2.8rem, 16vw, 4rem);
    }

    .weather-hero-footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .weather-hero-source {
        text-align: left;
    }

    .weather-hero-location {
        max-width: 100%;
        border-radius: 10px;
        font-size: 0.72rem;
    }

    footer {
        margin-top: 20px;
        padding-top: 14px;
        font-size: 0.75rem;
    }
}

@media (max-width: 360px) {
    .header-actions {
        gap: 4px;
    }

    .location-button,
    .header-actions > .btn-secondary {
        padding: 9px 7px;
        font-size: 0.74rem;
    }
}