/* Opening Hours Widget (kompakt) — kabdalis2 design system.
   .kabdalis-opening-hours-widget is the JS-locked wrapper. view.js adds
   .ohw + .b-card at runtime. CSS targets the actual save() DOM classes
   (.opening-hours-widget-*, .opening-hours-date-*, .oh-icon) alongside
   the .ohw__* aliases so styling lands regardless of injection state. */

.kabdalis-opening-hours-widget.ohw{
    padding: var(--card-pad);
}
.ohw--bare{ padding: 0; background: none; border: 0; box-shadow: none; }

/* The actual stack lives one level down in .opening-hours-widget-container
   (save() wraps title, datebar, list and CTA in it), so the vertical rhythm
   has to live here — a gap on .ohw would only see this single wrapper child.
   20px keeps the title, datepicker bar, opening-hours list (own internal row
   padding) and bottom CTA on the same rhythm without crowding. The calendar
   overlay is position:absolute, so it's out of flow and never eats a gap slot;
   the JS-inserted closure-notice / slopes containers sit in here too and
   inherit the same spacing. */
.opening-hours-widget-container{
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Head — kicker + title (view.js wraps the legacy title in .ohw__head) */
.ohw__head{ display: flex; flex-direction: column; gap: 2px; }
.ohw__title,
.opening-hours-widget-title{
    font-family: var(--font-display);
    font-weight: var(--display-w);
    letter-spacing: var(--display-ls);
    font-size: 1.3rem;
    line-height: 1.1;
    margin: 0;
    color: var(--ink);
}

/* Date selector — prev / date-display / next on one row.
   Critical: nowrap on date text + min-width:0 on flex children so the
   selector survives narrow column layouts (~30% screen width). */
.ohw__datebar,
.opening-hours-widget-date-selector{
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.opening-hours-date-display{
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 13px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.opening-hours-date-display:hover{ border-color: var(--accent); }

.opening-hours-date-text{
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1 1 auto;
    text-align: center;
}

.opening-hours-date-picker-trigger{
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--ink-soft);
    cursor: pointer;
    border-radius: 999px;
}
.opening-hours-date-picker-trigger:hover{ color: var(--accent); }
.opening-hours-date-picker-trigger i{ font-size: .85rem; }

.opening-hours-widget-date-nav-prev,
.opening-hours-widget-date-nav-next{
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-soft);
    cursor: pointer;
}
.opening-hours-widget-date-nav-prev:hover,
.opening-hours-widget-date-nav-next:hover{
    border-color: var(--accent);
    color: var(--accent);
}
.opening-hours-widget-date-nav-prev i,
.opening-hours-widget-date-nav-next i{ font-size: .9rem; }

/* Narrow columns: shrink nav buttons + collapse date-display padding */
@media (max-width: 420px){
    .opening-hours-widget-date-nav-prev,
    .opening-hours-widget-date-nav-next{ width: 34px; height: 34px; }
    .opening-hours-date-display{ padding: 8px 10px; }
}

.opening-hours-closure-notice:empty{ display: none; }
.opening-hours-closure-notice{
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--warn) 9%, var(--surface));
    border-left: 3px solid var(--warn);
    color: var(--ink);
    font-size: .92rem;
    line-height: 1.5;
}

/* Empty state — rendered when no opening hours for the selected date.
   view.js first paints a "Letar efter nästa öppna dag…" body, then swaps in
   the actual next-open-day suggestion (button) or a no-availability message. */
.opening-hours-widget-empty{
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px 16px;
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--accent) 5%, var(--surface));
    border: 1px solid var(--line);
}
.opening-hours-widget-empty-icon{
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    color: var(--accent);
    font-size: 1rem;
}
.opening-hours-widget-empty-text{
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.opening-hours-widget-empty-title{
    font-family: var(--font-display);
    font-weight: var(--display-w);
    font-size: 1rem;
    line-height: 1.25;
    color: var(--ink);
}
.opening-hours-widget-empty-body{
    margin: 0;
    color: var(--ink-soft);
    font-size: .88rem;
    line-height: 1.5;
}
.opening-hours-widget-empty-cta{
    align-self: flex-start;
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    gap: .55em;
}
.opening-hours-widget-empty-cta i{
    font-size: .82rem;
    line-height: 1;
}

/* Opening hours list — flex column of rows.
   Vertical padding chosen to match the 32px icon block height (16px on each
   side of the icon = 14px above/below row content) so rows read as balanced
   horizontal bands rather than cramped one-liners. */
.opening-hours-widget-list{
    display: flex;
    flex-direction: column;
}
.opening-hours-widget-row{
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.opening-hours-widget-row:first-child{
    border-top: 0;
    padding-top: 4px;
}
.opening-hours-widget-row:last-child{ padding-bottom: 4px; }
.opening-hours-widget-row.opening-hours-widget-row-event{
    /* Events sometimes have an image instead of an icon */
    align-items: flex-start;
}

/* Icon container — 32px square on the left of each row */
.opening-hours-widget-icon{
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    color: var(--accent);
}
.opening-hours-widget-icon i{ font-size: 1.05rem; }
.oh-icon{
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    color: var(--accent);
}
.oh-icon i{ font-size: 1.05rem; }
.ohf-svg-icon{
    width: 22px;
    height: 22px;
    display: block;
}

/* Event thumbnail */
.opening-hours-widget-image{
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--surface2);
}
.opening-hours-widget-image img{
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Details column — name + time + optional description */
.opening-hours-widget-details{
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.ohw__name,
.opening-hours-widget-name{
    font-weight: 500;
    color: var(--ink);
    line-height: 1.25;
}
.opening-hours-widget-time{
    font-family: var(--font-mono);
    font-size: .78rem;
    color: var(--ink-soft);
    letter-spacing: .02em;
}
.opening-hours-widget-description{
    font-size: .8rem;
    color: var(--muted);
    line-height: 1.4;
    margin-top: 2px;
}

.opening-hours-slopes-lifts-container:empty{ display: none; }

/* Slopes breakdown — view.js (renderSlopesLifts) fills the container above with
   an "Öppna backar" section: a headline + one row per piste grade. The swatch is
   an empty span coloured by the row's data-color using the FIS piste tokens
   (same source as slopes-lifts-widget). Only shown when data-show-slopes-lifts. */
.opening-hours-slopes-section{
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid var(--line);
    padding-top: 14px;
}
.opening-hours-slopes-headline{
    font-family: var(--font-mono);
    font-size: .66rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
}
.opening-hours-slopes-breakdown{
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.opening-hours-slope-breakdown-item{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 3px 0;
}
.opening-hours-slope-breakdown-left{
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.opening-hours-slope-breakdown-color{
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
    display: inline-block;
    background: var(--muted);
}
.opening-hours-slope-breakdown-item[data-color="green"] .opening-hours-slope-breakdown-color{ background: var(--piste-green); }
.opening-hours-slope-breakdown-item[data-color="blue"] .opening-hours-slope-breakdown-color{ background: var(--piste-blue); }
.opening-hours-slope-breakdown-item[data-color="red"] .opening-hours-slope-breakdown-color{ background: var(--piste-red); }
.opening-hours-slope-breakdown-item[data-color="black"] .opening-hours-slope-breakdown-color{ background: var(--piste-black); }
.opening-hours-slope-breakdown-item[data-color="offpiste"] .opening-hours-slope-breakdown-color{ background: var(--piste-offpiste); }
.opening-hours-slope-breakdown-label{ color: var(--ink); }
.opening-hours-slope-breakdown-value{
    color: var(--ink-soft);
    font-variant-numeric: tabular-nums;
}
.opening-hours-slope-breakdown-value .separator{ opacity: .7; margin: 0 1px; }

/* Transient "Laddar..." shown between the fade-out and the data swap. */
.loading-message{
    padding: 14px 0;
    text-align: center;
    color: var(--muted);
    font-size: .9rem;
}

/* Bottom CTA — runtime overlays .btn.btn--outline (matches Snörapport
   "Pistkarta" button style). Visible top-separator so the button doesn't
   look glued to the last row. */
.opening-hours-widget-calendar-link{
    align-self: flex-start;
    margin-top: 6px;
}

/* Calendar dialog (overlay) */
.opening-hours-calendar-overlay{
    position: absolute;
    inset: 0;
    z-index: 4;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: color-mix(in srgb, var(--ink) 45%, transparent);
}
.opening-hours-calendar-overlay.is-open{ display: flex; }
.opening-hours-calendar-dialog{
    width: 100%;
    max-width: 320px;
    padding: 16px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: 0 30px 70px -20px color-mix(in srgb, var(--ink) 60%, transparent);
}
.opening-hours-calendar-header{
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-weight: 600;
    color: var(--ink);
}
.opening-hours-calendar-month{ flex: 1; text-align: center; }
.opening-hours-calendar-prev,
.opening-hours-calendar-next,
.opening-hours-calendar-close{
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    color: var(--ink-soft);
    cursor: pointer;
    border: none;
    background: transparent;
}
.opening-hours-calendar-prev:hover,
.opening-hours-calendar-next:hover,
.opening-hours-calendar-close:hover{
    background: var(--surface2);
    color: var(--ink);
}
.opening-hours-calendar-grid{
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}
.opening-hours-calendar-grid > button{
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: .82rem;
    color: var(--ink);
    cursor: pointer;
    border: none;
    background: transparent;
}
.opening-hours-calendar-grid > button:hover{
    background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.opening-hours-calendar-grid > button.is-selected{
    background: var(--accent);
    color: var(--on-accent);
}
.opening-hours-calendar-close{ margin: 12px auto 0; }
