/* Module: modals.css — all modal dialogs, overlays, drawers, cookie banner, smart filter modals */

/* ============================================
   SMART FILTER MODAL (Premium Style - first block)
   ============================================ */
.sf-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    z-index: 2000;
    animation: sfFadeIn 0.25s ease;
}

.sf-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    z-index: 2001;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: sfSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes sfFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes sfSlideUp {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.sf-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    position: sticky;
    top: 0;
}

.sf-modal-header h5 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: -0.025em;
}

.sf-modal-close {
    background: #f1f5f9;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

.sf-modal-close:hover {
    background: #e2e8f0;
    color: #1e293b;
    transform: rotate(90deg);
}

.sf-modal-body {
    padding: 16px 24px 24px;
    overflow-y: auto;
    flex: 1;
    background: #fafafa;
}

.sf-modal-section {
    margin-bottom: 24px;
}

.sf-modal-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    margin-bottom: 12px;
}

/* Sub-Gruppen innerhalb eines Filter-Sections (z.B. "Buchstabengröße",
   "EU-Schuhgröße" unter dem Hauptlabel "Größe"). Eingeführt 2026-05-24
   für Mischmasch-Filter-Cleanup. */
.sf-modal-subgroup {
    margin-bottom: 14px;
}
.sf-modal-subgroup:last-child {
    margin-bottom: 0;
}
.sf-modal-subgroup-title {
    font-size: 0.72rem;
    font-weight: 600;
    color: #94a3b8;
    margin-bottom: 6px;
    padding-left: 2px;
}

.sf-modal-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sf-modal-chips .chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #475569;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.sf-modal-chips .chip:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.sf-modal-chips .chip.active {
    background: #00A8CC;
    color: #ffffff;
    border-color: #00A8CC;
    box-shadow: 0 4px 12px rgba(0, 168, 204, 0.25);
    background: linear-gradient(135deg, #00A8CC 0%, #008eb0 100%);
}

.sf-modal-chips .chip .cnt {
    font-size: 0.75rem;
    opacity: 0.6;
}

.sf-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 16px;
    background: #ffffff;
}

.sf-modal-btn {
    flex: 1;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    border: none;
}

.sf-modal-btn.btn-primary {
    background: #00A8CC;
    color: white;
}

.sf-modal-btn.btn-primary:hover {
    background: #008eb0;
    transform: translateY(-1px);
}

.sf-modal-btn.btn-link {
    background: transparent;
    color: #64748b;
    font-weight: 600;
}

.sf-modal-btn.btn-link:hover {
    color: #ef4444;
}

@media (max-width: 576px) {
    .sf-modal {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .sf-modal-footer {
        padding-bottom: env(safe-area-inset-bottom, 20px);
    }
}

/* ============================================
   SMART FILTER MODAL (Second block - alternate style)
   ============================================ */

/* Modal Overlay */
.sf-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1050;
    backdrop-filter: blur(2px);
    display: none;
}

/* Modal Container */
.sf-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 1055;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    display: none;
}

.sf-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

.sf-modal-header h5 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.sf-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #757575;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.sf-modal-close:hover {
    background-color: #f5f5f5;
    color: #333;
}

.sf-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
}

.sf-modal-section {
    margin-bottom: 24px;
}

.sf-modal-section:last-child {
    margin-bottom: 0;
}

.sf-modal-section-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sf-modal-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 16px;
    background-color: #f5f5f5;
    border: 1px solid #e0e0e0;
    font-size: 0.9rem;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    color: #444;
}

.chip:hover {
    background-color: #e0e0e0;
}

.chip.active {
    background-color: #e3f2fd;
    border-color: #90caf9;
    color: #1565c0;
    font-weight: 500;
}

.chip .cnt {
    font-size: 0.75rem;
    color: #757575;
    margin-left: 6px;
    opacity: 0.8;
}

.chip.active .cnt {
    color: #1976d2;
}

.sf-modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background-color: #fcfcfc;
}

.sf-modal-btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.sf-modal-btn.btn-primary {
    background-color: #00A8CC;
    color: white;
    border: none;
}

.sf-modal-btn.btn-primary:hover {
    background-color: #008fae;
}

.sf-modal-btn.btn-link {
    background: none;
    border: none;
    color: #666;
}

.sf-modal-btn.btn-link:hover {
    color: #333;
    text-decoration: underline;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translate(-50%, -45%);
        opacity: 0;
    }

    to {
        transform: translate(-50%, -50%);
        opacity: 1;
    }
}

.sf-overlay[style*="block"] {
    animation: fadeIn 0.2s ease-out;
}

.sf-modal[style*="block"] {
    animation: slideUp 0.3s ease-out;
}

/* Mobile Adjustments */
@media (max-width: 576px) {
    .sf-modal {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        top: 0;
        left: 0;
        transform: none;
        border-radius: 0;
    }

    .sf-modal[style*="block"] {
        animation: none;
        /* Full screen slide in could be added here */
    }
}

/* ── Mobile Filter Bottom Sheet ── */
.mobile-filter-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1055;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.mobile-filter-overlay.active {
    display: block;
    opacity: 1;
}

@media (max-width: 768px) {
    #filterSidebar {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        width: 100% !important;
        max-height: 80vh;
        overflow-y: auto;
        z-index: 1060;
        border-radius: 20px 20px 0 0 !important;
        box-shadow: 0 -4px 30px rgba(0,0,0,0.15);
        /* Geschlossen: komplett aus dem Viewport schieben (105% statt 100%
           fängt Rendering-Artefakte auf iOS Safari ab) UND visibility:hidden
           damit der Box-Shadow nicht als 1-2px weißer Schimmer am Bildschirm-
           rand sichtbar bleibt. Visibility wird nach Animation umgeschaltet. */
        transform: translateY(105%);
        visibility: hidden;
        transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1),
                    visibility 0s linear 0.3s;
        display: block !important;
        background: #fff;
        padding: 20px 16px 32px !important;
    }

    #filterSidebar.mobile-open {
        transform: translateY(0);
        visibility: visible;
        transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1),
                    visibility 0s linear 0s;
    }

    /* Drag-Handle oben */
    #filterSidebar::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: #ddd;
        border-radius: 2px;
        margin: 0 auto 16px;
    }

    /* ── Mobile Sort Bottom Sheet ── */
    .mobile-sort-sheet {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #fff;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -4px 30px rgba(0,0,0,0.15);
        padding: 8px 20px 28px;
        z-index: 1060;
        /* Selbe Logik wie #filterSidebar: 105% + visibility-toggle
           gegen iOS-Safari-Render-Artefakte am unteren Bildschirmrand. */
        transform: translateY(105%);
        visibility: hidden;
        transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1),
                    visibility 0s linear 0.3s;
        max-height: 80vh;
        overflow-y: auto;
    }
    .mobile-sort-sheet.open {
        transform: translateY(0);
        visibility: visible;
        transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1),
                    visibility 0s linear 0s;
    }

    .mss-handle {
        width: 40px;
        height: 4px;
        background: #ddd;
        border-radius: 2px;
        margin: 6px auto 14px;
    }
    .mss-title {
        font-size: 1.05rem;
        font-weight: 700;
        margin: 0 0 14px;
        color: #1a1a1b;
    }
    .mss-group { margin-bottom: 18px; }
    .mss-group-label {
        font-size: 0.78rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: #6b7280;
        margin-bottom: 6px;
    }
    .mss-option {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 4px;
        font-size: 0.95rem;
        color: #1a1a1b;
        cursor: pointer;
        border-bottom: 1px solid #f1f5f9;
    }
    .mss-option:last-child { border-bottom: none; }
    .mss-option input[type="radio"] {
        accent-color: #00A8CC;
        width: 18px;
        height: 18px;
        margin: 0;
    }
    .mss-close-btn {
        display: block;
        width: 100%;
        background: #1a1a1b;
        color: #fff;
        border: none;
        border-radius: 50px;
        padding: 12px;
        font-size: 0.95rem;
        font-weight: 600;
        margin-top: 8px;
        cursor: pointer;
    }
}

/* Default-State außerhalb der Mobile-Media-Query: Sort-Sheet versteckt
   (auf Desktop nie sichtbar — Sortierung läuft dort über die Selects oben) */
.mobile-sort-sheet {
    display: none;
}
@media (max-width: 768px) {
    .mobile-sort-sheet { display: block; }

    /* Smart Filters Bar im mobilen Drawer anzeigen */
    .mobile-sf-section {
        display: none;
        margin-bottom: 4px;
    }

    .mobile-sf-section.active {
        display: block;
    }

    /* Smart Filters Bar oben auf der Seite auf Mobile ausblenden (liegt im Drawer) */
    #smartFiltersBar {
        display: none !important;
    }
}

/* Feed Config Drawer */
#feedConfigDrawer {
    --bs-offcanvas-width: min(90vw, 820px);
}

@media (max-width: 768px) {
    #feedConfigDrawer {
        --bs-offcanvas-width: 100vw;
    }
}

/* Cookie Banner */
.cookie-banner {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    padding: 20px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    border-top: 1px solid #eee;
}

.cookie-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cookie-content h4 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.1rem;
}

.cookie-buttons {
    display: flex;
    gap: 10px;
}

.cookie-buttons button {
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.cookie-buttons .accept-all {
    background-color: #3498db;
    color: white;
}

.cookie-buttons .accept-all:hover {
    background-color: #2980b9;
}

.cookie-buttons .customize {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #2c3e50;
}

.cookie-buttons .customize:hover {
    background-color: #e9ecef;
}

.cookie-settings {
    background: #fff;
    border: 1px solid #eee;
    padding: 15px;
    margin-top: 10px;
    border-radius: 4px;
    display: none;
}
