/* ================================================================
   Öffnungszeiten
   Gemeinsam genutzt von der Detailseite (partials/opening_hours)
   und dem Karten-Panel (component_map.js).

   Aufbau:
     .oh                 Container
     .oh-status          Status-Badge ("Geöffnet – bis 17:00 Uhr")
     .oh-week / .oh-day  Tagesliste der nächsten 7 Tage mit Tagesbalken
     .oh-axis            Zeitachse unter den Balken
     .oh-callout         Hinweis auf saisonale Zeiten
     .oh-upcoming        Chips mit den nächsten Öffnungstagen
     .oh-rules           Aufklappbare Liste aller Regeln
     .oh-details         Aufklappbare Variante (Karten-Panel)
   ================================================================ */

.oh,
.oh-details
{
    --oh-text:        #1e293b;
    --oh-muted:       #475569;
    --oh-subtle:      #64748b;
    --oh-line:        #e2e8f0;
    --oh-today-bg:    #eaf2fe;
    --oh-bar-fill:    #22c55e;
    --oh-radius:      10px;
}

.oh
{
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    width: 100%;
    color: var(--oh-text);
}

/* ── Status-Badge ──────────────────────────────────────────────── */

.oh-status
{
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem 0.55rem;
    font-size: 0.9rem;
    line-height: 1.3;
}

.oh-status__pill
{
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.28rem 0.7rem 0.28rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.oh-status__dot
{
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.oh-status__detail { color: var(--oh-muted); }

.oh-status--open    .oh-status__pill { background: #dcfce7; color: #166534; }
.oh-status--closing .oh-status__pill,
.oh-status--opening .oh-status__pill { background: #fef3c7; color: #92400e; }
.oh-status--closed  .oh-status__pill { background: #fee2e2; color: #991b1b; }
.oh-status--unknown .oh-status__pill { background: #f1f5f9; color: #475569; }

.oh-status--open .oh-status__dot
{
    animation: oh-pulse 2.4s ease-out infinite;
}

@keyframes oh-pulse
{
    0%   { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.45); }
    70%  { box-shadow: 0 0 0 6px rgba(22, 163, 74, 0); }
    100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

/* ── Tagesliste ────────────────────────────────────────────────── */

.oh-week
{
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.oh-day
{
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    column-gap: 0.75rem;
    row-gap: 0.35rem;
    padding: 0.5rem 0.65rem;
    border-radius: var(--oh-radius);
}

.oh-day--today
{
    background: var(--oh-today-bg);
    box-shadow: inset 3px 0 0 var(--color-primary);
}

.oh-day__name
{
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.15rem 0.45rem;
    min-width: 0;
    font-size: 0.9rem;
    font-weight: 600;
}

.oh-day__date
{
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--oh-subtle);
    font-variant-numeric: tabular-nums;
}

.oh-day__badge
{
    align-self: center;
    padding: 0.08rem 0.45rem;
    border-radius: 999px;
    background: var(--color-primary);
    color: var(--color-text-on-primary, #fff);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.oh-day__hours
{
    text-align: right;
    font-size: 0.9rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.oh-day--closed .oh-day__hours,
.oh-day--unknown .oh-day__hours
{
    color: var(--oh-subtle);
    font-weight: 400;
}

.oh-day__holiday
{
    display: block;
    margin-top: 0.1rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: #b45309;
}

/* Tagesbalken 0–24 Uhr */
.oh-day__bar
{
    grid-column: 1 / -1;
    position: relative;
    height: 6px;
    border-radius: 3px;
    background: var(--oh-line);
    overflow: hidden;
}

/* Hilfslinien bei 6, 12 und 18 Uhr */
.oh-day__bar::after
{
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg,
            transparent calc(25% - 1px), rgba(255, 255, 255, 0.85) calc(25% - 1px),
            rgba(255, 255, 255, 0.85) 25%, transparent 25%,
            transparent calc(50% - 1px), rgba(255, 255, 255, 0.85) calc(50% - 1px),
            rgba(255, 255, 255, 0.85) 50%, transparent 50%,
            transparent calc(75% - 1px), rgba(255, 255, 255, 0.85) calc(75% - 1px),
            rgba(255, 255, 255, 0.85) 75%, transparent 75%);
    pointer-events: none;
}

.oh-day__bar-fill
{
    position: absolute;
    top: 0;
    bottom: 0;
    border-radius: 3px;
    background: var(--oh-bar-fill);
}

.oh-day--today .oh-day__bar           { background: #cfe0fb; }
.oh-day--today .oh-day__bar-fill      { background: var(--color-primary); }

/* Aktuelle Uhrzeit im heutigen Balken */
.oh-day__now
{
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    margin-left: -1px;
    background: #0f172a;
    z-index: 1;
}

/* Zeitachse */
.oh-axis
{
    position: relative;
    height: 0.9rem;
    margin: -0.35rem 0.65rem 0;
    font-size: 0.68rem;
    color: var(--oh-subtle);
    font-variant-numeric: tabular-nums;
}

.oh-axis span
{
    position: absolute;
    top: 0;
    transform: translateX(-50%);
}

.oh-axis span:first-child { transform: none; }
.oh-axis span:last-child  { transform: translateX(-100%); }

/* ── Hinweise ─────────────────────────────────────────────────── */

.oh-callout
{
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.7rem 0.85rem;
    border: 1px solid #fde68a;
    border-radius: var(--oh-radius);
    background: #fffbeb;
    color: #78350f;
    font-size: 0.83rem;
    line-height: 1.45;
}

.oh-callout svg
{
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.oh-callout strong { display: block; font-weight: 700; }

.oh-section-title
{
    margin: 0 0 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--oh-muted);
}

.oh-empty
{
    margin: 0;
    font-size: 0.85rem;
    color: var(--oh-subtle);
}

/* Nächste Öffnungstage */
.oh-upcoming
{
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0;
    padding: 0;
}

.oh-upcoming li
{
    display: flex;
    flex-direction: column;
    padding: 0.4rem 0.65rem;
    border: 1px solid var(--oh-line);
    border-radius: 8px;
    background: #fff;
    font-size: 0.8rem;
    line-height: 1.35;
}

.oh-upcoming__date  { font-weight: 600; }
.oh-upcoming__hours { color: var(--oh-muted); font-variant-numeric: tabular-nums; }

/* Alle Regeln */
.oh-rules { font-size: 0.83rem; }

.oh-rules > summary
{
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    list-style: none;
    color: var(--color-primary);
    font-weight: 600;
    border-radius: 4px;
}

.oh-rules > summary::-webkit-details-marker { display: none; }
.oh-rules > summary:hover { text-decoration: underline; }

.oh-rules ul
{
    margin: 0.45rem 0 0;
    padding-left: 1.1rem;
    color: #334155;
    line-height: 1.6;
}

.oh-rules[open] .oh-chevron { transform: rotate(180deg); }

/* ── Aufklappbare Variante (Karten-Panel) ─────────────────────── */

.oh-details { width: 100%; }

.oh-summary
{
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    list-style: none;
    border-radius: 6px;
}

.oh-summary::-webkit-details-marker { display: none; }
.oh-summary .oh-status { flex: 1; }

.oh-details[open] > .oh-summary .oh-chevron { transform: rotate(180deg); }
.oh-details > .oh { margin-top: 0.75rem; }

.oh-chevron
{
    flex-shrink: 0;
    color: var(--oh-subtle, #64748b);
    transition: transform 0.18s ease;
}

/* ── Fokus & Bewegung ─────────────────────────────────────────── */

.oh-summary:focus-visible,
.oh-rules > summary:focus-visible
{
    outline: 3px solid #0057b7;
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce)
{
    .oh-status--open .oh-status__dot { animation: none; }
    .oh-chevron { transition: none; }
}
