/* Polished minimalist Dash theme (dark) */
:root {
    /* Dark theme - true black */
    --bg: #0a0a0a;
    --panel: #141414;
    --panel2: #1a1a1a;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.08);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 16px 38px rgba(0, 0, 0, 0.5);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --radius: 14px;
    --radius-sm: 10px;
    --accent: #3b82f6;
    --accent-2: rgba(59, 130, 246, 0.18);
}

html,
body {
    height: 100%;
}

body {
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji",
        "Segoe UI Emoji";
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
}

/* App header */
.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 16px;
    background: #000000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-left {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-width: 0;
}

.header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.brand-logo {
    height: 24px;
    width: auto;
    display: block;
}

.brand-lockup {
    height: 44px;
    border-radius: 22px;
    background: #3a3a3a;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
}

.brand-logo-text {
    height: 22px;
    width: auto;
    filter: brightness(0) invert(1);
    /* Make logo white */
}

.brand-title {
    font-size: 14px;
    font-weight: 650;
    letter-spacing: 0.2px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-subtitle {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
}

.header-tabs {
    min-width: 0;
}

.header-tabs .tab-container {
    display: flex;
    justify-content: flex-start;
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: #1a1a1a;
}

/* Hide the internal tab content container since we render content elsewhere */
.header-tabs .tab-content {
    display: none;
}

/* Dash Tabs classes */
.tab {
    border: 1px solid transparent !important;
    border-radius: 999px !important;
    padding: 8px 12px !important;
    font-weight: 600 !important;
    color: var(--muted) !important;
    background: transparent !important;
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.tab:hover {
    background: rgba(255, 255, 255, 0.06) !important;
    color: var(--text) !important;
}

.tab--selected {
    color: #ffffff !important;
    background: #3a3a3a !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: var(--shadow-sm) !important;
}

.tab:focus {
    outline: none !important;
}

.tab--selected:focus {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1) !important;
}

/* Standard page shell: left filters, right content */
.page-shell {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 16px;
    padding: 16px;
    max-width: 1600px;
    margin: 0 auto;
}

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

.sidebar {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 14px;
    position: sticky;
    top: 72px;
    /* below header */
    height: fit-content;
}

@media (max-width: 1100px) {
    .sidebar {
        position: static;
    }
}

.sidebar-section {
    padding: 10px;
    border-radius: var(--radius-sm);
    background: var(--panel2);
    border: 1px solid var(--border);
}

.sidebar-section+.sidebar-section {
    margin-top: 12px;
}

.sidebar-title {
    font-size: 12px;
    font-weight: 650;
    color: var(--text);
    margin: 0 0 10px 0;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

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

.control+.control {
    margin-top: 12px;
}

.control label {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
}

.main {
    min-width: 0;
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 12px;
}

.card+.card {
    margin-top: 12px;
}

.graph-card {
    padding: 10px;
}

/* Dash core component styling hooks */
.Select,
.DateInput,
.DateRangePickerInput {
    width: 100%;
}

/* Tweak react-select inside dcc.Dropdown */
.Select-control {
    border-radius: 10px !important;
    border: 1px solid var(--border) !important;
    box-shadow: none !important;
    min-height: 38px !important;
    background: rgba(255, 255, 255, 0.03) !important;
}

.Select-value-label,
.Select-placeholder,
.Select-input>input {
    color: var(--text) !important;
}

.Select-arrow-zone {
    color: var(--muted) !important;
}

.Select-option {
    background: var(--panel) !important;
    color: var(--text) !important;
}

.Select-option.is-focused {
    background: rgba(255, 255, 255, 0.06) !important;
}

.Select-option.is-selected {
    background: rgba(59, 130, 246, 0.22) !important;
}

.Select-placeholder,
.Select--single>.Select-control .Select-value {
    line-height: 36px !important;
}

.Select-menu-outer {
    border-radius: 12px !important;
    border: 1px solid var(--border) !important;
    box-shadow: var(--shadow) !important;
    background: var(--panel) !important;
}

/* DatePickerSingle / react-dates */
.DateInput {
    background: transparent !important;
}

.DateInput_input {
    background: rgba(255, 255, 255, 0.03) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    border-radius: 10px !important;
    height: 38px !important;
    line-height: 38px !important;
    padding: 0 10px !important;
}

.DateInput_input__focused {
    border: 1px solid rgba(59, 130, 246, 0.55) !important;
    box-shadow: 0 0 0 3px var(--accent-2) !important;
}

.SingleDatePickerInput {
    background: transparent !important;
}

.SingleDatePickerInput__withBorder {
    border: none !important;
    background: transparent !important;
}

.SingleDatePickerInput_calendarIcon {
    background: transparent !important;
}

.SingleDatePickerInput__showClearDate {
    background: transparent !important;
}

.SingleDatePickerInput__disabled {
    background: transparent !important;
}

.DateInput_fang {
    fill: var(--panel) !important;
}

.SingleDatePickerInput_clearDate__default {
    color: var(--muted) !important;
}

.SingleDatePickerInput_clearDate__default:hover {
    color: var(--text) !important;
}

.SingleDatePicker_picker,
.DayPicker {
    background: var(--panel) !important;
    border: 1px solid var(--border) !important;
    box-shadow: var(--shadow) !important;
}

.CalendarDay__default {
    background: var(--panel) !important;
    border: 1px solid rgba(148, 163, 184, 0.14) !important;
    color: var(--text) !important;
}

.CalendarDay__default:hover {
    background: rgba(255, 255, 255, 0.06) !important;
}

.CalendarDay__outside {
    color: rgba(226, 232, 240, 0.35) !important;
}

.CalendarDay__selected,
.CalendarDay__selected:hover {
    background: rgba(59, 130, 246, 0.35) !important;
    border: 1px solid rgba(59, 130, 246, 0.55) !important;
    color: var(--text) !important;
}

.DayPickerNavigation_button {
    background: rgba(255, 255, 255, 0.04) !important;
    border: 1px solid var(--border) !important;
}

.DayPickerNavigation_svg__horizontal {
    fill: var(--muted) !important;
}

/* Info boxes */
.notice {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    font-size: 12px;
}

.warning {
    background: rgba(245, 158, 11, 0.10);
    border-color: rgba(245, 158, 11, 0.22);
    color: #fbbf24;
}

.info-panel {
    background: rgba(59, 130, 246, 0.10);
    border-color: rgba(59, 130, 246, 0.22);
    color: #93c5fd;
}

.era5-warning {
    background: rgba(180, 40, 40, 0.15);
    border-color: rgba(220, 60, 60, 0.35);
    color: #f87171;
    font-weight: 500;
}

/* Video container */
.video-card video {
    border-radius: 12px;
}

/* Keep plotly graphs snug in cards */
.js-plotly-plot,
.plot-container {
    width: 100% !important;
}