/* Scoped styles for the Trail Status Widget */
.trail-status-widget {
    font-family: 'Inter', -apple-system, sans-serif;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    overflow: hidden;
    max-width: 600px;
    margin: 20px auto;
    border: 1px solid #eaeaea;
}

.widget-header {
    background: #1a202c;
    color: #ffffff;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.widget-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.trail-status-widget .widget-header.widget-header-closed h2 {
    color: #f56565 !important;
    transition: color 0.3s ease;
}

/* Ensure the overlay variant handles the red header text gracefully */
.trail-status-widget.widget-overlay .widget-header.widget-header-closed h2 {
    color: #f56565 !important;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
}

.last-updated {
    font-size: 0.8rem;
    opacity: 0.8;
}

.widget-tabs {
    display: flex;
    background: #f7fafc;
    border-bottom: 1px solid #e2e8f0;
}

.widget-tab {
    flex: 1;
    padding: 15px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-weight: 600;
    color: #4a5568;
    transition: all 0.2s;
}

.widget-tab:hover {
    color: #2d3748;
    background: #edf2f7;
}

.widget-tab.active {
    color: #3182ce;
    border-bottom-color: #3182ce;
}

.widget-content {
    display: none;
    padding: 20px;
}

.widget-content.active {
    display: block;
}

.status-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.public-status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 4px solid #cbd5e0;
    transition: transform 0.1s;
}

.public-status-item:hover {
    transform: translateX(4px);
}

.public-status-item.status-open {
    border-left-color: #48bb78;
}

.public-status-item.status-closed {
    border-left-color: #f56565;
}

.public-status-item.status-hold {
    border-left-color: #ecc94b;
}

.public-status-item.status-groomed {
    border-left-color: #4299e1;
}

.item-title {
    font-weight: 600;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 8px;
}

.item-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-open { background: #c6f6d5; color: #22543d; }
.badge-closed { background: #fed7d7; color: #742a2a; }
.badge-hold { background: #fefcbf; color: #744210; }
.badge-groomed { background: #bee3f8; color: #2a4365; }

.difficulty-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.diff-green { background: #48bb78; }
.diff-blue { background: #4299e1; border-radius: 2px; }
.diff-black { background: #1a202c; border-radius: 2px; transform: rotate(45deg); }

.loading-spinner {
    text-align: center;
    padding: 20px;
    color: #a0aec0;
    font-style: italic;
}

/* =========================================
   ITERATION: Desktop Media View
   ========================================= */
.trail-status-widget.widget-desktop {
    max-width: 100%;
}

.trail-status-widget.widget-desktop .widget-tabs {
    display: none; /* Hide tabs for desktop view */
}

/* Create a side-by-side grid for the content areas */
.trail-status-widget.widget-desktop {
    display: flex;
    flex-wrap: wrap;
}

.trail-status-widget.widget-desktop .widget-header {
    width: 100%;
}

.trail-status-widget.widget-desktop .widget-content {
    display: block; /* Force both to show */
    flex: 1;
    min-width: 300px;
    border-right: 1px solid #e2e8f0;
}

.trail-status-widget.widget-desktop .widget-content:last-child {
    border-right: none;
}

.trail-status-widget.widget-desktop .widget-content::before {
    content: "Lifts";
    display: block;
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 15px;
    color: #2d3748;
}

.trail-status-widget.widget-desktop .widget-trails::before {
    content: "Trails";
}

/* =========================================
   ITERATION: Minimal Horizontal
   ========================================= */
.trail-status-widget.widget-horizontal {
    max-width: 100%;
    border-radius: 8px;
}

.trail-status-widget.widget-horizontal .widget-header {
    padding: 10px 15px;
}

.trail-status-widget.widget-horizontal .widget-header h2 {
    font-size: 1rem;
}

.trail-status-widget.widget-horizontal .widget-tabs {
    display: flex;
    padding: 0;
}

.trail-status-widget.widget-horizontal .widget-tab {
    padding: 8px 15px;
    font-size: 0.9rem;
}

.trail-status-widget.widget-horizontal .widget-content {
    padding: 10px;
}

/* Make the list horizontal and scrollable */
.trail-status-widget.widget-horizontal .status-grid {
    flex-direction: row;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 5px; /* for scrollbar */
}

/* Custom scrollbar for horizontal view */
.trail-status-widget.widget-horizontal .status-grid::-webkit-scrollbar {
    height: 6px;
}
.trail-status-widget.widget-horizontal .status-grid::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.trail-status-widget.widget-horizontal .public-status-item {
    flex: 0 0 auto; /* Prevent shrinking */
    min-width: 200px;
    padding: 10px;
}

.trail-status-widget.widget-horizontal .item-title {
    font-size: 0.9rem;
}

.trail-status-widget.widget-horizontal .item-badge {
    font-size: 0.75rem;
    padding: 3px 8px;
}

/* =========================================
   ITERATION: Ultra Minimalist (Micro)
   ========================================= */
/* The layout logic can piggyback on widget-horizontal if desired, 
   or just stand alone. Here we handle the micro elements. */
.trail-status-widget.widget-micro .public-status-item {
    padding: 8px 12px;
    min-width: auto;
}

.trail-status-widget.widget-micro .item-title {
    font-size: 0.95rem;
    font-weight: 700;
}

/* The small status bullet replacing the text badge */
.micro-status-bullet {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-left: 8px;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.8);
}

.micro-open { background: #48bb78; }
.micro-closed { background: #f56565; }
.micro-hold { background: #ecc94b; }
.micro-groomed { background: #4299e1; }

/* =========================================
   ITERATION: Seasonal Modes
   ========================================= */
/* If explicitly MTB or Modal, hide Lifts and Winter Trails */
.trail-status-widget.widget-mtb .widget-tab[data-target="widget-lifts"],
.trail-status-widget.widget-mtb .widget-tab[data-target="widget-trails"],
.trail-status-widget.widget-modal .widget-tab[data-target="widget-lifts"],
.trail-status-widget.widget-modal .widget-tab[data-target="widget-trails"] {
    display: none;
}
/* If Winter (or default), hide MTB */
.trail-status-widget:not(.widget-mtb) .widget-tab[data-target="widget-mtb"] {
    display: none;
}

/* =========================================
   ITERATION: Overlay View (Hero/Attic Image)
   ========================================= */
.trail-status-widget.widget-overlay {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    border: none;
    box-shadow: none;
    color: #ffffff;
    max-width: 100%;
    margin: 0;
    padding: 15px;
    backdrop-filter: blur(4px); /* Adds a nice frosted glass effect */
}

.trail-status-widget.widget-overlay .widget-header {
    background: transparent;
    padding: 0 0 10px 0;
    color: #ffffff;
}

.trail-status-widget.widget-overlay .widget-header h2 {
    font-size: 1rem;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
}

.trail-status-widget.widget-overlay .last-updated {
    text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
    opacity: 0.9;
}

.widget-overlay-view {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.85rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.overlay-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.overlay-row-label {
    font-weight: bold;
    color: #cbd5e0;
    margin-right: 5px;
    white-space: nowrap;
}

.overlay-row-items {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.overlay-status-item {
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.trail-status-widget.widget-overlay .item-name-text {
    font-weight: 500;
}

/* =========================================
   ITERATION: Modal View
   ========================================= */
.trail-status-modal-wrapper {
    display: inline-block;
}

.status-modal-trigger {
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    /* Default fallback colors if JS hasn't applied badge class yet */
    background: #cbd5e0;
    color: #2d3748;
}

/* Trigger inherits the standard badge colors cleanly */
.status-modal-trigger.badge-open { background: #48bb78; color: #ffffff; }
.status-modal-trigger.badge-closed { background: #f56565; color: #ffffff; }
.status-modal-trigger.badge-hold { background: #ecc94b; color: #744210; }
.status-modal-trigger.badge-groomed { background: #4299e1; color: #ffffff; }
.status-modal-trigger.badge-some-closures { background: #ecc94b; color: #744210; }

.status-modal-trigger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 10px rgba(0,0,0,0.15);
}

.status-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s, visibility 0.3s;
}

.status-modal-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.status-modal-content {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 20px;
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.status-modal-overlay.hidden .status-modal-content {
    transform: translateY(30px);
}

.status-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 2.5rem;
    cursor: pointer;
    line-height: 1;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    transition: transform 0.2s;
}

.status-modal-close:hover {
    transform: scale(1.1);
}

/* Make sure the widget itself doesn't have huge margins when inside the modal */
.status-modal-content .trail-status-widget {
    margin: 0;
    max-height: 90vh;
    overflow-y: auto;
}
