/* ═══════════════════════════════════════════════════════════════════
 * /css/open-filter.css
 * Open-Filter, Open-Badge, Öffnungszeiten-Zeile
 * Ergänzt index.css, kein Ersatz
 * ═══════════════════════════════════════════════════════════════════ */

/* ─── Filter-Wrap (Grundlayout) ─────────────────────────────────── */
.open-filter-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
    align-items: center;
    justify-content: center;
    max-width: 1100px;
    margin: 0 auto 16px;
    padding: 10px 16px;
    background: var(--card, #fff);
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

/* ─── Filter-Wrap direkt unter den Tabs ─────────────────────────── */
.open-filter-wrap--under-tabs {
    max-width: 1100px;
    margin: -1px auto 16px;
    border-radius: 0 0 12px 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: none;
    background: var(--card, #fff);
    padding: 10px 16px;
}

/* ─── Toggle-Label ──────────────────────────────────────────────── */
.open-filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text, #2d3748);
    white-space: nowrap;
}

.open-filter-toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* ─── Slider-Switch ─────────────────────────────────────────────── */
.open-filter-slider {
    position: relative;
    width: 40px;
    height: 22px;
    background: #cbd5e0;
    border-radius: 22px;
    transition: background 0.25s ease;
    flex-shrink: 0;
}

.open-filter-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.25s ease;
}

.open-filter-toggle input:checked + .open-filter-slider {
    background: var(--primary, #F37700);
}

.open-filter-toggle input:checked + .open-filter-slider::after {
    transform: translateX(18px);
}

.open-filter-toggle input:focus-visible + .open-filter-slider {
    outline: 2px solid var(--primary, #F37700);
    outline-offset: 2px;
}

.open-filter-label {
    line-height: 1.2;
}

/* ─── Empty-State (serverseitig + clientseitig) ─────────────────── */
.open-filter-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted, #6c757d);
    font-size: 1rem;
    line-height: 1.6;
}

.open-filter-show-all {
    display: inline-block;
    margin-top: 12px;
    color: var(--primary, #F37700);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.open-filter-show-all:hover {
    border-bottom-color: var(--primary, #F37700);
}

/* ═══════════════════════════════════════════════════════════════════
 * ÖFFNUNGSZEITEN-ZEILE IN DER CARD (neu)
 * ═══════════════════════════════════════════════════════════════════ */
.pcard-opening-hours {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--muted, #6c757d);
    padding: 4px 10px;
    border-left: 3px solid var(--primary, #F37700);
    margin: 6px 12px 8px;
    background: transparent;
    line-height: 1.4;
}

.pcard-opening-hours i {
    font-size: 0.72rem;
    opacity: 0.85;
    flex-shrink: 0;
}

.pcard-opening-hours span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Mobile: etwas kompakter */
@media (max-width: 640px) {
    .pcard-opening-hours {
        font-size: 0.7rem;
        padding: 3px 8px;
        margin: 4px 10px 6px;
        border-left-width: 2px;
    }
}

/* ═══════════════════════════════════════════════════════════════════
 * OPEN-BADGE – GRUNDLAYOUT (Desktop: absolut in .pcard-img)
 * ═══════════════════════════════════════════════════════════════════ */
.open-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1.3;
    color: #fff;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    white-space: nowrap;
    max-width: calc(100% - 16px);
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

/* ─── Offen: kräftiger grüner Verlauf + Glow + Puls + Punkt ─────── */
.open-badge.open {
    background: linear-gradient(135deg, #16a34a 0%, #22c55e 100%);
    border: 1px solid rgba(255, 255, 255, 0.35);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.25),
        0 0 8px rgba(34, 197, 94, 0.55),
        0 0 20px rgba(34, 197, 94, 0.35);
    animation: openBadgePulse 2.4s ease-in-out infinite;
}

.open-badge.open::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
    flex-shrink: 0;
    animation: openBadgeDotPulse 2.4s ease-in-out infinite;
}

/* ─── Küche zu: orange, dezenter Glow, kein Puls ────────────────── */
.open-badge.kitchen_closed {
    background: linear-gradient(135deg, #ea580c 0%, #f97316 100%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.2),
        0 0 6px rgba(249, 115, 22, 0.45),
        0 0 14px rgba(249, 115, 22, 0.25);
}

/* ─── Öffnet bald: gelb, dezenter Glow, kein Puls ───────────────── */
.open-badge.opening_soon {
    background: linear-gradient(135deg, #ca8a04 0%, #eab308 100%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.2),
        0 0 6px rgba(234, 179, 8, 0.45),
        0 0 14px rgba(234, 179, 8, 0.25);
}

/* ─── Geschlossen / Saison / Unbekannt: grau, kein Glow ─────────── */
.open-badge.closed,
.open-badge.closed_seasonal,
.open-badge.unknown {
    background: rgba(107, 114, 128, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: none;
}

/* ═══════════════════════════════════════════════════════════════════
 * WARN-OVERRIDES (Client-Countdown)
 * ═══════════════════════════════════════════════════════════════════ */
.open-badge[data-warning="yellow"] {
    background: linear-gradient(135deg, #ca8a04 0%, #eab308 100%) !important;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.2),
        0 0 6px rgba(234, 179, 8, 0.45),
        0 0 14px rgba(234, 179, 8, 0.25) !important;
}

.open-badge[data-warning="orange"] {
    background: linear-gradient(135deg, #ea580c 0%, #f97316 100%) !important;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.2),
        0 0 6px rgba(249, 115, 22, 0.45),
        0 0 14px rgba(249, 115, 22, 0.25) !important;
}

.open-badge[data-warning="red"] {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%) !important;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.25),
        0 0 8px rgba(239, 68, 68, 0.55),
        0 0 20px rgba(239, 68, 68, 0.35) !important;
}

/* ═══════════════════════════════════════════════════════════════════
 * KEYFRAMES
 * ═══════════════════════════════════════════════════════════════════ */
@keyframes openBadgePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow:
            0 0 0 1px rgba(255, 255, 255, 0.25),
            0 0 8px rgba(34, 197, 94, 0.55),
            0 0 20px rgba(34, 197, 94, 0.35);
    }
    50% {
        transform: scale(1.04);
        box-shadow:
            0 0 0 1px rgba(255, 255, 255, 0.35),
            0 0 12px rgba(34, 197, 94, 0.75),
            0 0 28px rgba(34, 197, 94, 0.55);
    }
}

@keyframes openBadgeDotPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.65;
        transform: scale(1.25);
    }
}

/* ═══════════════════════════════════════════════════════════════════
 * REDUCED MOTION
 * ═══════════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    .open-badge.open,
    .open-badge.open::before {
        animation: none !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════
 * MOBILE (max 640px)
 * ─────────────────────────────────────────────────────────────────
 * Open-Badge im Body unter .share-save-row:
 * - volle Breite, umbrechend, zentriert
 * - kein absolutes Positioning
 * - Abstand nach oben (über den Share-Buttons)
 * ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {

    /* Animationen aus, um Ablenkung zu vermeiden */
    .open-badge.open,
    .open-badge.open::before {
        animation: none !important;
    }

    /* Mobile-Variante: relative Position im Body */
    .open-badge-mobile {
        position: relative !important;
        bottom: auto !important;
        left: auto !important;
        right: auto !important;
        top: auto !important;
        display: flex !important;
        width: 100% !important;
        max-width: 100% !important;
        margin-top: 8px;
        padding: 8px 12px;
        font-size: 12px;
        line-height: 1.3;
        white-space: normal;
        word-break: break-word;
        text-align: center;
        justify-content: center;
        align-items: center;
        flex-wrap: wrap;
        gap: 4px;
        border-radius: 8px;
        overflow: visible;
        text-overflow: clip;
        box-sizing: border-box;
        z-index: 1;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    /* Desktop-Variante im Bild ausblenden */
    .open-badge-desktop {
        display: none !important;
    }

    /* Filter-Wrap kompakter */
    .open-filter-wrap--under-tabs {
        padding: 8px 12px;
        gap: 8px 16px;
    }
    .open-filter-label {
        font-size: 0.75rem;
    }
}