/* ============================================================
   Cookie-Consent Banner + Re-Open Widget
   ============================================================
   Layout-konvention: BEM-aehnlich, prefix "cookie-consent-"
   keine !important Ueberschreiben — CSP/Design-System konform
   ============================================================ */

/* === Modal === */
.cookie-consent-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.cookie-consent-modal[hidden] {
    display: none;
}

.cookie-consent-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
}

.cookie-consent-dialog {
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    max-width: 520px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.5rem;
    color: #1f2937;
    font-family: inherit;
}

.cookie-consent-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.cookie-consent-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #4f46e5;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.cookie-consent-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    color: #111827;
}

.cookie-consent-body {
    margin-bottom: 1.25rem;
}

.cookie-consent-intro {
    color: #4b5563;
    font-size: 0.92rem;
    line-height: 1.55;
    margin: 0 0 1.25rem 0;
}

/* === Kategorien === */
.cookie-consent-categories {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cookie-consent-category {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.85rem 1rem;
    transition: background 0.15s ease;
}

.cookie-consent-category:hover {
    background: #f3f4f6;
}

.cookie-consent-category--essential {
    background: #f9fafb;
}

.cookie-consent-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.cookie-consent-category-name {
    font-weight: 500;
    color: #111827;
    font-size: 0.95rem;
}

.cookie-consent-category-state-locked {
    color: #10b981;
    font-size: 0.85rem;
    font-weight: 500;
}

.cookie-consent-category-desc {
    color: #6b7280;
    font-size: 0.85rem;
    line-height: 1.45;
    margin: 0.45rem 0 0 0;
}

/* === Toggle-Switch (statt Bootstrap-Switch fuer Unabhaengigkeit) === */
.cookie-consent-toggle {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 22px;
    cursor: pointer;
    flex-shrink: 0;
}

.cookie-consent-toggle-input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.cookie-consent-toggle-slider {
    position: absolute;
    inset: 0;
    background: #d1d5db;
    border-radius: 22px;
    transition: background 0.2s ease;
}

.cookie-consent-toggle-slider::before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    top: 3px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.cookie-consent-toggle-input:checked + .cookie-consent-toggle-slider {
    background: #4f46e5;
}

.cookie-consent-toggle-input:checked + .cookie-consent-toggle-slider::before {
    transform: translateX(20px);
}

.cookie-consent-toggle-input:focus-visible + .cookie-consent-toggle-slider {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

/* === Footer / Buttons === */
.cookie-consent-footer {
    border-top: 1px solid #e5e7eb;
    padding-top: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cookie-consent-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.cookie-consent-btn {
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 0.65rem 1rem;
    font-size: 0.92rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    font-family: inherit;
}

.cookie-consent-btn--primary {
    background: #2563eb;
    color: #ffffff;
}

.cookie-consent-btn--primary:hover {
    background: #1d4ed8;
}

.cookie-consent-btn--secondary {
    background: #f3f4f6;
    color: #1f2937;
    border-color: #e5e7eb;
}

.cookie-consent-btn--secondary:hover {
    background: #e5e7eb;
}

.cookie-consent-btn-link {
    background: none;
    border: none;
    color: #2563eb;
    font-weight: 500;
    cursor: pointer;
    padding: 0.4rem 0;
    text-align: center;
    font-size: 0.9rem;
    font-family: inherit;
}

.cookie-consent-btn-link:hover {
    text-decoration: underline;
}

.cookie-consent-policy-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.8rem;
}

.cookie-consent-policy-links a {
    color: #6b7280;
    text-decoration: underline;
}

.cookie-consent-policy-links a:hover {
    color: #1f2937;
}

/* === Re-Open Widget === */
.cookie-consent-reopen {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 9999;
    background: #ffffff;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    padding: 0.55rem 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cookie-consent-reopen:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
}

.cookie-consent-reopen i {
    color: #f59e0b;
}

/* Re-Open versteckt waehrend Modal sichtbar */
.cookie-consent-modal:not([hidden]) ~ .cookie-consent-reopen,
body.cookie-modal-open .cookie-consent-reopen {
    display: none;
}

/* === Mobile-Tuning === */
@media (max-width: 480px) {
    .cookie-consent-dialog {
        padding: 1.2rem;
    }
    .cookie-consent-actions {
        grid-template-columns: 1fr;
    }
    .cookie-consent-reopen span {
        display: none;
    }
    .cookie-consent-reopen {
        padding: 0.6rem;
        width: 42px;
        height: 42px;
        justify-content: center;
    }
}
