/* ===========================
    MAP + POPUPS
    =========================== */

#map {
    min-height: 480px;
}

.btr-aq-snowflake-marker img {
    display: none;
}

/* High-contrast AQ snow station marker */
.btr-aq-snowflake-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 2px solid #009cff;
    color: #009cff;
    font-size: 13px;
    font-weight: 700;
    line-height: 18px;

    box-shadow:
        0 0 3px rgba(255, 255, 255, 0.9),
        0 0 6px rgba(255, 255, 255, 0.9);
}

.btr-aq-popup, .btr-av-popup {
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 12px;
}
.btr-aq-popup-name, .btr-av-popup-name { font-weight: 600; margin-bottom: 3px; }
.btr-aq-popup-group, .btr-av-popup-group { font-size: 11px; color: #a4a9b7; margin-bottom: 4px; }
.btr-aq-popup-meta, .btr-av-popup-meta { font-size: 11px; color: #8c91a2; }

.leaflet-popup-content-wrapper {
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ===========================
    STATION PANEL
    =========================== */

#avalanche-container {
    margin-top: 12px;
}

#avalanche-container h3 {
    margin: 0 0 4px;
    font-size: 15px;
}

.station-header {
    margin-bottom: 6px;
}

.station-source {
    font-size: 12px;
    color: #a4a9b7;
    margin-top: 2px;
}

.station-meta {
    font-size: 12px;
    line-height: 1.4;
    color: #d0d3dd;
    margin-bottom: 6px;
}

/* BC panel wrapper */
#station-readings-panel {
    margin-top: 12px;
    max-width: 1600px;
    background-color: #f0f0f0;
    margin: auto;
    border-radius: 12px;
    box-shadow:
        5px 5px 10px #cccccc,
        -5px -5px 10px #ffffff;
}

/* NL panel wrapper – same layout as BC */
#nl-aq-panel {
    margin-top: 12px;
    max-width: 1600px;
    margin: auto;
}

#station-readings-panel .station-header {
    margin-bottom: 4px;
}

/* ===========================
    READINGS TABLE (CORE)
    =========================== */

.station-readings-table-wrapper {
    max-height: 260px;
    overflow-y: auto;
    overflow-x: auto; /* horizontal scroll on small screens */
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

/* 4 columns: Time | Temp | Snow | Precip */
.station-readings-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;      /* let browser size columns naturally */
    font-size: 11px;
    min-width: 480px;        /* avoid columns collapsing too hard */
}

/* Optional: enforce consistent column widths via colgroup */
.station-readings-table col.col-time {
    width: 22%;
}
.station-readings-table col.col-temp,
.station-readings-table col.col-snow,
.station-readings-table col.col-precip {
    width: 26%;
}

/* Sticky header */
.station-readings-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(8, 10, 16, 0.95);
    backdrop-filter: blur(4px);
}

.station-readings-table th,
.station-readings-table td {
    padding: 4px 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    white-space: nowrap;
    font-size: 11px;
    line-height: 1.3;
    box-sizing: border-box;
}

/* Column alignment */
.station-readings-table th:nth-child(1),
.station-readings-table td:nth-child(1) {
    text-align: left; /* Time */
}

.station-readings-table th:nth-child(2),
.station-readings-table td:nth-child(2),
.station-readings-table th:nth-child(3),
.station-readings-table td:nth-child(3),
.station-readings-table th:nth-child(4),
.station-readings-table td:nth-child(4) {
    text-align: right; /* numeric columns */
}

.station-readings-table th {
    font-weight: 600;
    color: #c9cede;
}

/* Zebra + hover */
.station-readings-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.station-readings-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.04);
}

/* Latest row highlight */
.station-readings-table tbody tr.latest-row {
    background: rgba(66, 184, 131, 0.12);
}

/* ===========================
    DAILY GROUPS (COLLAPSIBLE) - FIXED FOR ALIGNMENT
    =========================== */

/* Everything for one day lives in <tbody class="day-group"> */
.day-group.collapsed .day-row {
    display: none;
}

/* Day header row styles - Now a 4-cell row for alignment */
.station-readings-table tr.day-header-row {
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
    font-size: 10px;
    font-weight: 500;
}

/* Apply header border and padding to all cells */
.station-readings-table tr.day-header-row td {
    padding: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    /* white-space: nowrap prevents long numbers/units from wrapping */
    white-space: nowrap;
}

/* Time/Toggle column styling (Column 1) */
.station-readings-table td.col-day-summary-time {
    /* Use flex to align the toggle indicator and text */
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

.day-title {
    font-weight: 600;
}

.day-toggle-indicator {
    font-size: 10px;
    display: inline-block;
}

/* Hover for header row */
.station-readings-table tr.day-header-row:hover {
    background: rgba(255, 255, 255, 0.07);
}

/* Hourly rows */
.station-readings-table tr.day-row {
    font-size: 10px;
}

/*
 * NOTE: The following old Flexbox/Colspan styles have been REMOVED because
 * the day-header-row now uses four separate <td> elements.
 * .day-summary-inner, .day-summary-left, .day-summary-metrics, .metric-pill
 * are no longer needed for the header row.
*/

/* ===========================
    CHART
    =========================== */

.station-chart-wrapper {
    margin-top: 10px;
    height: 400px;
}

.station-chart-wrapper canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ===========================
    RANGE BUTTONS
    =========================== */

.station-range-buttons {
    margin-top: 8px;
    font-size: 11px;
}

.station-range-buttons .range-label {
    margin-right: 6px;
    opacity: 0.8;
}

.station-range-buttons .range-btn-row {
    display: inline-flex;
    gap: 4px;
    flex-wrap: wrap;
}

.station-range-buttons .range-btn {
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.35);
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 11px;
    cursor: pointer;
}

.station-range-buttons .range-btn.active {
    background: rgba(255, 255, 255, 0.15);
}

/* ===========================
    HEADER TOTALS
    =========================== */

.station-header-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.station-header-left {
    flex: 1 1 230px;
}

.station-header-right {
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    margin-top: 18px;
    margin-bottom: 10px;
    gap: 12px;
    font-size: 1.17em;
    text-align: right;
    color: #444;
}

.station-totals {
    min-width: 110px;
}

.station-meta-block.station-totals {
    font-size: 13px;
    line-height: 1.4;
    color: #444;
    text-align: right;
}

/* "New Snow" title */
.station-meta-title {
    font-size: 14px;
    font-weight: 600;
    color: #000;
    margin-bottom: 4px;
}

/* Each row: 1 Day / 3 Days / 7 Days */
.station-meta-row {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    margin: 1px 0;
}

/* Left label (1 Day, 3 Days, 7 Days) */
.station-meta-label {
    font-weight: 600;
    color: #555;
}

/* Right value (XX cm) */
.station-meta-value {
    font-weight: 500;
    color: #000;
}

/* ===========================
    RESPONSIVE TWEAKS
    =========================== */

@media (max-width: 1024px) {
    .station-readings-table {
        font-size: 10px;
    }

    .station-readings-table th,
    .station-readings-table td {
        padding: 3px 4px;
    }

    .station-readings-table-wrapper {
        max-height: 220px;
    }
}

@media (max-width: 600px) {
    .station-readings-table {
        font-size: 9px;
        min-width: 420px; /* allow some horizontal scroll */
    }

    .station-readings-table th,
    .station-readings-table td {
        padding: 3px 3px;
    }

    .station-readings-table-wrapper {
        max-height: 220px;
    }
    /* No additional changes needed here for the fixed alignment */
}