/* PimcorePrivacyBundle - Cookie Consent Modal Styles */

.cookie-consent-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 999999;
    pointer-events: none;
    font-family: system-ui, -apple-system, sans-serif;
    box-sizing: border-box;
}

.cookie-consent-modal.is-visible {
    pointer-events: all;
}

.cookie-consent-modal *,
.cookie-consent-modal *::before,
.cookie-consent-modal *::after {
    box-sizing: border-box;
}

.cookie-consent-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.cookie-consent-modal.is-visible .cookie-consent-backdrop {
    opacity: 1;
}

.cookie-consent-container {
    position: relative;
    margin: 0 auto;
    background: white;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: translateY(-100%);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.cookie-consent-modal.is-visible .cookie-consent-container {
    transform: translateY(0);
}

.cookie-consent-header {
    padding: 25px 30px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.cookie-consent-header h2 {
    margin: 0 !important;
    font-size: 24px !important;
    color: #333 !important;
    line-height: 1.3 !important;
}

.cookie-consent-body {
    padding: 25px 30px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-height: 0; /* damit der Body im Flex-Container schrumpft und scrollt, Header/Footer bleiben sichtbar */
}

.cookie-consent-intro {
    margin-bottom: 25px !important;
    color: #666 !important;
    line-height: 1.6 !important;
}

.cookie-consent-categories {
    display: flex !important;
    flex-direction: column !important;
    gap: 15px !important;
}

.cookie-category {
    border: 2px solid #e5e7eb !important;
    border-radius: 8px !important;
    padding: 15px !important;
    transition: all 0.3s !important;
    background: white !important;
}

.cookie-category:hover {
    border-color: #3b82f6 !important;
    background: #f9fafb !important;
}

.cookie-category-header {
    display: flex !important;
    gap: 15px !important;
    align-items: flex-start !important;
}

.cookie-toggle {
    position: relative !important;
    display: inline-block !important;
    width: 50px !important;
    height: 26px !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.cookie-toggle input {
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    position: absolute !important;
}

.toggle-slider {
    position: absolute !important;
    cursor: pointer !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background-color: #ccc !important;
    transition: .4s !important;
    border-radius: 26px !important;
}

.toggle-slider:before {
    position: absolute !important;
    content: "" !important;
    height: 18px !important;
    width: 18px !important;
    left: 4px !important;
    bottom: 4px !important;
    background-color: white !important;
    transition: .4s !important;
    border-radius: 50% !important;
}

.cookie-toggle input:checked + .toggle-slider {
    background-color: #10b981 !important;
}

.cookie-toggle input:checked + .toggle-slider:before {
    transform: translateX(24px) !important;
}

.cookie-toggle input:disabled + .toggle-slider {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

.cookie-category-info {
    flex: 1 !important;
}

.cookie-category-info h3 {
    margin: 0 0 5px 0 !important;
    font-size: 16px !important;
    color: #333 !important;
    line-height: 1.3 !important;
}

.cookie-category-desc {
    margin: 0 !important;
    font-size: 14px !important;
    color: #666 !important;
    line-height: 1.5 !important;
}

.cookie-consent-footer {
    padding: 20px 30px !important;
    border-top: 1px solid #e5e7eb !important;
    display: flex !important;
    flex-direction: row !important;
    gap: 10px !important;
    flex-wrap: wrap !important;
    flex-shrink: 0 !important;
}

.pcp-btn {
    display: inline-block !important;
    padding: 12px 24px !important;
    border: none !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s !important;
    flex: 1 !important;
    min-width: 120px !important;
    max-width: none !important;
    width: auto !important;
    height: auto !important;
    line-height: normal !important;
    text-align: center !important;
    text-decoration: none !important;
    box-shadow: none !important;
    letter-spacing: normal !important;
}

.pcp-btn-reject {
    background: #f3f4f6 !important;
    color: #374151 !important;
}

.pcp-btn-reject:hover {
    background: #e5e7eb !important;
}

.pcp-btn-accept-selected {
    background: #3b82f6 !important;
    color: white !important;
}

.pcp-btn-accept-selected:hover {
    background: #2563eb !important;
}

.pcp-btn-accept-all {
    background: #10b981 !important;
    color: white !important;
}

.pcp-btn-accept-all:hover {
    background: #059669 !important;
}

/* ------------------------------------------------------------------
   Handy / schmale Bildschirme: kompakter, Header und Buttons immer sichtbar,
   nur der Mittelteil scrollt.
   ------------------------------------------------------------------ */
@media (max-width: 767px) {
    .cookie-consent-modal {
        /* gleicher Abstand zum Fenster oben, unten, links und rechts; top+bottom folgt dem sichtbaren Bereich */
        --pcp-gap: 16px;
        bottom: 0;
        padding: var(--pcp-gap);
    }

    /* reCAPTCHA-Hinweis nutzt dieselben Klassen, steht aber im Seitenfluss: kein Fensterabstand */
    #recaptcha-consent-modal {
        padding: 0;
        bottom: auto;
    }

    .cookie-consent-container {
        width: 100%;
        border-radius: 12px;
        /* fuellt den sichtbaren Bereich abzueglich Rand: gleicher Abstand rundherum, auch wenn der Inhalt kuerzer ist */
        height: 100%;
        height: min(100%, calc(100svh - 2 * var(--pcp-gap)));
        max-height: none;
        transform: translateY(calc(-100% - 40px));
    }

    .cookie-consent-modal.is-visible .cookie-consent-container {
        transform: translateY(0);
    }

    .cookie-consent-header {
        padding: 14px 16px;
    }

    .cookie-consent-header h2 {
        font-size: 19px !important;
    }

    .cookie-consent-body {
        padding: 12px 16px;
    }

    .cookie-consent-intro {
        margin-bottom: 12px !important;
        font-size: 14px !important;
        line-height: 1.5 !important;
    }

    .cookie-consent-categories {
        gap: 8px !important;
    }

    .cookie-category {
        padding: 10px !important;
    }

    .cookie-category-header {
        gap: 10px !important;
    }

    .cookie-category-info h3 {
        font-size: 15px !important;
    }

    .cookie-category-desc {
        font-size: 13px !important;
        line-height: 1.4 !important;
    }

    .cookie-consent-footer {
        padding: 12px 16px !important;
        gap: 8px !important;
    }

    /* "Nur Notwendige" und "Auswahl speichern" nebeneinander, "Alle akzeptieren" volle Breite darunter */
    .pcp-btn {
        padding: 11px 10px !important;
        min-width: 0 !important;
        flex: 1 1 calc(50% - 4px) !important;
    }

    .pcp-btn-accept-all {
        flex-basis: 100% !important;
    }
}

/* Niedrige Bildschirme (Querformat am Handy): alles in eine Zeile, minimal hoch */
@media (max-height: 500px) and (max-width: 932px) {
    .cookie-consent-header {
        padding: 8px 16px;
    }

    .cookie-consent-header h2 {
        font-size: 16px !important;
    }

    .cookie-consent-body {
        padding: 8px 16px;
    }

    .cookie-consent-intro {
        margin-bottom: 8px !important;
    }

    .cookie-consent-footer {
        padding: 8px 16px !important;
        flex-wrap: nowrap !important;
    }

    .pcp-btn,
    .pcp-btn-accept-all {
        padding: 9px 8px !important;
        flex: 1 1 0 !important;
        font-size: 13px !important;
    }
}
