/*
 * Projects/Workbench/MNG/css/monitoring-widgets.css
 * Inline monitoring data widgets for place profile drawers.
 * Design: Field guide aesthetic — warm parchment palette, Georgia serif.
 *
 * Widget types: weather_station, acoustic_monitor, garden_station, strata_climate
 * Rendered by monitoring-widgets.js inside NA drawer containers.
 *
 * v2.1 — February 28, 2026: Accessible sizing (partial vision),
 *        warm palette via CSS variables, Chart.js support.
 */


/* ================================================================
   CONTAINER — hidden by default, slides open on "View data" click
   ================================================================ */

[id^="monitoring-widget-"] {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}
[id^="monitoring-widget-"].widget-open {
    max-height: 800px;
    margin-top: 0.75rem;
}


/* ================================================================
   BASE WIDGET
   ================================================================ */

.mw-widget {
    background: var(--bg-page);
    border: 1px solid var(--panel-places-border);
    border-radius: 6px;
    padding: 1rem 1.2rem;
    font-family: var(--font-data);
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.5;
}


/* ================================================================
   LOADING / ERROR
   ================================================================ */

.mw-loading {
    padding: 1.25rem;
    text-align: center;
    font-family: var(--font-data);
    font-size: 16px;
    color: var(--text-muted);
}

.mw-error {
    padding: 1rem;
    text-align: center;
    font-family: var(--font-data);
    font-size: 16px;
    color: var(--text-muted);
    font-style: italic;
}


/* ================================================================
   HERO — big temperature or detection count
   ================================================================ */

.mw-hero {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    margin-bottom: 0.4rem;
}

.mw-temp {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.mw-temp.mw-low {
    color: var(--panel-physical-accent);
}

.mw-sep {
    font-size: 26px;
    color: var(--text-muted);
}

.mw-conditions {
    font-family: var(--font-data);
    font-size: 18px;
    color: var(--text-secondary);
}

.mw-range {
    font-family: var(--font-data);
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 0.6rem;
}

.mw-count {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
}

.mw-label {
    font-family: var(--font-data);
    font-size: 18px;
    color: var(--text-secondary);
}


/* ================================================================
   FIELD GRID — label/value pairs in two columns
   ================================================================ */

.mw-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem 1.25rem;
    margin: 0.6rem 0;
}

.mw-field {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.25rem 0;
    border-bottom: 1px solid rgba(44, 36, 22, 0.06);
}

.mw-field-label {
    font-family: var(--font-data);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.mw-field-value {
    font-family: var(--font-data);
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}


/* ================================================================
   TIMESTAMP / FOOTER
   ================================================================ */

.mw-timestamp {
    margin-top: 0.5rem;
    font-family: var(--font-data);
    font-size: 14px;
    color: var(--text-muted);
}

.mw-timestamp.mw-stale {
    color: #C07050;
}


/* ================================================================
   DATE HEADER (climate widget)
   ================================================================ */

.mw-date {
    font-family: var(--font-data);
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}


/* ================================================================
   BIRDS — acoustic monitor widget
   ================================================================ */

.mw-stat {
    font-family: var(--font-data);
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 0.6rem;
}

/* Singing now — living systems green */
.mw-singing {
    margin: 0.6rem 0;
    padding: 0.5rem 0.75rem;
    background: rgba(74, 122, 74, 0.08);
    border: 1px solid rgba(74, 122, 74, 0.15);
    border-radius: 6px;
}

.mw-singing-label {
    font-family: var(--font-data);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--panel-living-accent);
    margin-bottom: 0.35rem;
    font-weight: 700;
}

.mw-bird-tag {
    display: inline-block;
    background: rgba(74, 122, 74, 0.12);
    color: var(--panel-living-accent);
    padding: 0.2rem 0.6rem;
    border-radius: 3px;
    font-family: var(--font-data);
    font-size: 15px;
    font-weight: 600;
    margin: 0.15rem 0.25rem 0.15rem 0;
}

/* Top species bars */
.mw-top {
    margin: 0.6rem 0;
}

.mw-top-label {
    font-family: var(--font-data);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
    font-weight: 600;
}

.mw-species-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.25rem 0;
}

.mw-species-name {
    font-family: var(--font-data);
    font-size: 15px;
    color: var(--text-secondary);
    min-width: 130px;
    flex-shrink: 0;
}

.mw-species-bar {
    height: 8px;
    background: var(--panel-living-accent);
    border-radius: 3px;
    flex-shrink: 0;
    opacity: 0.7;
    transition: width 0.3s ease;
}

.mw-species-count {
    font-family: var(--font-data);
    font-size: 14px;
    color: var(--text-muted);
    min-width: 28px;
    text-align: right;
}


/* ================================================================
   CHART — Chart.js canvas for temperature/precip (climate widget)
   ================================================================ */

.mw-chart-wrap {
    margin: 0.75rem 0 0.4rem;
    position: relative;
}

.mw-chart-wrap canvas {
    width: 100% !important;
    height: 180px !important;
}


/* ================================================================
   WEEK SUMMARY (climate)
   ================================================================ */

.mw-week-summary {
    font-family: var(--font-data);
    font-size: 15px;
    color: var(--text-secondary);
    margin: 0.5rem 0 0.25rem;
}

.mw-week-label {
    font-weight: 700;
    color: var(--text-primary);
}


/* ================================================================
   CARD HUB — icon-only cards (no click-anywhere, no expand hint)
   ================================================================ */

.na-card.na-card-hub {
    cursor: default;
}

.na-card.na-card-hub .expand-hint {
    display: none;
}


/* ================================================================
   CARD ACTIONS — icon buttons on hub-style card faces
   General pattern: any card can use this for branching drawers.
   ================================================================ */

.na-card-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.35rem;
}

.na-card-action {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 72px;
    height: 72px;
    flex: 0 0 72px;
    padding: 0;
    background: var(--bg-page);
    border: 1.5px solid var(--panel-places-border);
    border-radius: 6px;
    color: var(--panel-places-accent);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.na-card-action:hover {
    background: #F5F0E8;
    border-color: var(--panel-places-accent);
    color: var(--panel-places-accent);
}

.na-card-action.active {
    background: var(--panel-places-accent);
    border-color: var(--panel-places-accent);
    color: #fff;
}

.na-card-action .lucide-icon {
    width: 36px;
    height: 36px;
    stroke-width: 1;
}

/* Physical instrument indicator — vivid green dot */
.na-card-action.mw-physical::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #34A853;
    border: 1.5px solid var(--bg-page);
}
.na-card-action.active.mw-physical::after {
    border-color: var(--panel-places-accent);
    background: #6FE08A;
}

/* Virtual source indicator — vivid blue dot */
.na-card-action.mw-virtual::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #EA4335;
    border: 1.5px solid var(--bg-page);
}
.na-card-action.active.mw-virtual::after {
    border-color: var(--panel-places-accent);
    background: #F28B82;
}


/* ================================================================
   WIDGET CONTAINER — inside each per-instrument drawer
   ================================================================ */

.mw-widget-container {
    min-height: 40px;
}

.mw-widget-container:empty {
    display: none;
}


/* ================================================================
   STRATA CLIMATE — subhero and daily range elements
   ================================================================ */

.mw-conditions {
    font-family: var(--font-data);
    font-size: 14px;
    color: var(--text-secondary);
    margin-left: 0.5rem;
}

.mw-subhero {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    font-family: var(--font-data);
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.mw-range {
    font-family: var(--font-data);
    font-size: 18px;
    margin-bottom: 0.5rem;
}

.mw-range .mw-high {
    color: var(--text-primary);
    font-weight: 600;
}

.mw-range .mw-low {
    color: var(--text-secondary);
}

.mw-range .mw-sep {
    color: var(--text-secondary);
    margin: 0 0.2rem;
}


/* ================================================================
   DASHBOARD LINK — "View in Macroscope" at bottom of widget
   ================================================================ */

.mw-dashboard-link {
    margin-top: 0.5rem;
    text-align: right;
}

.mw-dashboard-link a {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-family: var(--font-data);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    letter-spacing: 0.03em;
}

.mw-dashboard-link a:hover {
    color: var(--panel-places-accent);
}


/* ── Instrument icons in drawer titles and info panel ── */

.drawer-title > .lucide-icon {
    vertical-align: -3px;
    margin-right: 0.3rem;
    opacity: 0.7;
}

.na-monitor-header {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.na-monitor-header > .lucide-icon {
    flex-shrink: 0;
    opacity: 0.6;
}

/* ================================================================
   mw-pano — 360° Panorama Viewer Widget
   Appended to monitoring-widgets.css
   ================================================================ */

/* Viewer container */
.mw-pano-viewer-wrap {
    position: relative;
    width: 100%;
    border-radius: 6px;
    overflow: hidden;
    background: #1a1a1a;
}

.mw-pano-viewer {
    width: 100%;
    height: 280px;
    min-height: 280px;
}

.na-drawer .mw-pano-viewer {
    height: 280px;
    min-height: 280px;
}

/* Pannellum overrides inside our widget */
.mw-pano-viewer .pnlm-container {
    border-radius: 6px;
}

.mw-pano-viewer .pnlm-controls-container {
    bottom: 8px;
    left: 8px;
}

/* Title */
.mw-pano-title {
    font-family: var(--font-data);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary, #4A3F2E);
    margin-bottom: 0.4rem;
}

/* Gyroscope toggle button — overlays top-right of viewer */
.mw-pano-gyro {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    cursor: pointer;
    color: #4A3F2E;
    transition: background 0.15s, color 0.15s;
    padding: 0;
}

.mw-pano-gyro:hover {
    background: rgba(255, 255, 255, 1);
}

.mw-pano-gyro.active {
    background: var(--panel-places-accent, #3B6B5E);
    border-color: var(--panel-places-accent, #3B6B5E);
    color: #fff;
}

/* Timeline: date label + slider + range */
.mw-pano-timeline {
    margin-top: 0.5rem;
    padding: 0 0.15rem;
}

.mw-pano-date {
    font-family: var(--font-data);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #2C2416);
    text-align: center;
    margin-bottom: 0.25rem;
}

.mw-pano-date-single {
    margin-top: 0.4rem;
}

/* Range slider */
.mw-pano-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: rgba(44, 36, 22, 0.12);
    border-radius: 2px;
    outline: none;
    margin: 0.3rem 0;
}

.mw-pano-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--panel-places-accent, #3B6B5E);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.mw-pano-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--panel-places-accent, #3B6B5E);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Range labels (earliest / latest) */
.mw-pano-range {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-data);
    font-size: 11px;
    color: var(--text-muted, #6E6450);
}

/* Thumbnail strip */
.mw-pano-thumbs {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    padding: 0.5rem 0 0.25rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.mw-pano-thumb {
    flex: 0 0 auto;
    width: 64px;
    cursor: pointer;
    text-align: center;
    border-radius: 4px;
    border: 2px solid transparent;
    transition: border-color 0.15s, opacity 0.15s;
    opacity: 0.65;
}

.mw-pano-thumb:hover {
    opacity: 1;
}

.mw-pano-thumb.active {
    border-color: var(--panel-places-accent, #3B6B5E);
    opacity: 1;
}

.mw-pano-thumb img {
    width: 100%;
    height: 40px;
    object-fit: cover;
    border-radius: 2px;
    display: block;
}

.mw-pano-thumb span {
    display: block;
    font-family: var(--font-data);
    font-size: 9px;
    color: var(--text-muted, #6E6450);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Photopoint description */
/* YouTube 360° video link */
.mw-pano-youtube {
    text-align: right;
    margin: 0.35rem 0 0;
}

.mw-pano-youtube a {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-family: var(--font-data);
    font-size: 13px;
    font-weight: 600;
    color: var(--panel-places-accent);
    text-decoration: none;
    letter-spacing: 0.02em;
}

.mw-pano-youtube a:hover {
    color: var(--text-primary);
}

.mw-pano-youtube svg {
    flex-shrink: 0;
}

.mw-pano-info {
    font-family: var(--font-body);
    font-size: 12px;
    color: var(--text-muted, #6E6450);
    margin-top: 0.4rem;
    line-height: 1.4;
}

/* ================================================================
   MW-PANO-VIDEO — 360° Video specific
   ================================================================ */

.mw-pvid-canvas canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
}

.mw-pvid-canvas canvas:active {
    cursor: grabbing;
}

/* Play/pause overlay */
.mw-pvid-playpause {
    position: absolute;
    bottom: 10px;
    left: 10px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: background 0.15s;
}

.mw-pvid-playpause:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* Transport bar */
.mw-pvid-transport {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.35rem;
}

.mw-pvid-progress {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border-color, #D5CFC2);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.mw-pvid-progress::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--panel-places-accent, #3A7068);
    cursor: pointer;
}

.mw-pvid-time {
    font-family: var(--font-data);
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    min-width: 75px;
    text-align: right;
}

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

@media (max-width: 600px) {
    .mw-pano-viewer {
        height: 220px;
    }

    .mw-pano-thumb {
        width: 52px;
    }

    .mw-pano-thumb img {
        height: 32px;
    }
}


/* ================================================================
 *  360° VIDEO PANORAMA — Video.js overrides
 *  Widget: mw-pano-video.js
 * ================================================================ */

/* Video.js inside pano viewer — override VJS defaults */
.mw-pano-video .video-js {
    width: 100% !important;
    height: 100% !important;
    background: var(--bg-primary);
}

.mw-pano-video .video-js .vjs-big-play-button {
    z-index: 10;
}

/* Hide VJS error display (Pannellum handles rendering) */
.mw-pano-video .video-js .vjs-error-display {
    display: none;
}

/* Ensure gyro button overlays above Video.js controls */
.mw-pano-video .mw-pano-gyro {
    z-index: 20;
}

.mw-pano-video .mw-pano-viewer-wrap {
    height: 300px;
    position: relative;
}