/**
 * GDPR Cookie Consent Banner - DACH Compliant
 */

.cookie-consent {
    --cc-bg: #ffffff;
    --cc-bg-alt: #f9fafb;
    --cc-text: #111827;
    --cc-text-muted: #6b7280;
    --cc-border: #e5e7eb;
    --cc-primary: #1DB954;
    --cc-primary-hover: #18944A;
    --cc-btn-bg: #ffffff;
    --cc-btn-border: #d1d5db;
    --cc-btn-hover: #f3f4f6;
    --cc-toggle: #d1d5db;
    --cc-code-bg: #f3f4f6;
}

@media (prefers-color-scheme: dark) {
    .cookie-consent {
        --cc-bg: #1f2937;
        --cc-bg-alt: #111827;
        --cc-text: #f3f4f6;
        --cc-text-muted: #9ca3af;
        --cc-border: #374151;
        --cc-btn-bg: #374151;
        --cc-btn-border: #4b5563;
        --cc-btn-hover: #4b5563;
        --cc-toggle: #4b5563;
        --cc-code-bg: #374151;
    }
}

.cookie-consent {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.cookie-consent[hidden] {
    display: none !important;
}

.cookie-consent__container {
    width: 100%;
    max-width: 42rem;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--cc-bg);
    color: var(--cc-text);
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.cookie-consent__content {
    padding: 1.5rem;
}

.cookie-consent__title {
    margin: 0 0 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--cc-text);
}

.cookie-consent__text {
    margin: 0 0 0.75rem;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--cc-text-muted);
}

.cookie-consent__link {
    display: inline-block;
    font-size: 0.875rem;
    color: var(--cc-primary);
    text-decoration: underline;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

.cookie-consent__link:hover {
    text-decoration: none;
}

.cookie-consent__actions {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: var(--cc-bg-alt);
    border-top: 1px solid var(--cc-border);
    border-radius: 0 0 1rem 1rem;
}

.cookie-consent__btn {
    -webkit-box-flex: 1;
    -ms-flex: 1 1 auto;
    flex: 1 1 auto;
    min-width: 120px;
    padding: 0.75rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 500;
    text-align: center;
    border-radius: 0.5rem;
    cursor: pointer;
    -webkit-transition: background-color 0.15s, border-color 0.15s;
    transition: background-color 0.15s, border-color 0.15s;
    font-family: inherit;
}

.cookie-consent__btn--secondary {
    background: var(--cc-btn-bg);
    color: var(--cc-text);
    border: 1px solid var(--cc-btn-border);
}

.cookie-consent__btn--secondary:hover {
    background: var(--cc-btn-hover);
}

.cookie-consent__btn--primary {
    background: var(--cc-primary);
    color: #ffffff;
    border: 1px solid var(--cc-primary);
}

.cookie-consent__btn--primary:hover {
    background: var(--cc-primary-hover);
    border-color: var(--cc-primary-hover);
}

.cookie-consent__btn:focus {
    outline: 2px solid var(--cc-primary);
    outline-offset: 2px;
}

.cookie-consent__category {
    padding: 1rem 0;
    border-bottom: 1px solid var(--cc-border);
}

.cookie-consent__category:last-child {
    border-bottom: none;
}

.cookie-consent__category-header {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    -webkit-box-align: start;
    -ms-flex-align: start;
    align-items: flex-start;
    gap: 1rem;
}

.cookie-consent__category-info {
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
}

.cookie-consent__category-title {
    margin: 0 0 0.25rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--cc-text);
}

.cookie-consent__category-desc {
    margin: 0;
    font-size: 0.875rem;
    color: var(--cc-text-muted);
    line-height: 1.5;
}

.cookie-consent__toggle {
    -ms-flex-negative: 0;
    flex-shrink: 0;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
}

.cookie-consent__toggle--disabled {
    opacity: 0.6;
}

.cookie-consent__toggle--disabled label {
    font-size: 0.75rem;
    color: var(--cc-text-muted);
    margin-left: 0.5rem;
}

.cookie-consent__switch {
    position: relative;
    display: inline-block;
    width: 3rem;
    height: 1.5rem;
}

.cookie-consent__switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.cookie-consent__slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--cc-toggle);
    border-radius: 1.5rem;
    -webkit-transition: background-color 0.2s;
    transition: background-color 0.2s;
}

.cookie-consent__slider::before {
    content: "";
    position: absolute;
    height: 1.125rem;
    width: 1.125rem;
    left: 0.1875rem;
    bottom: 0.1875rem;
    background: #ffffff;
    border-radius: 50%;
    -webkit-transition: -webkit-transform 0.2s;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.cookie-consent__switch input:checked + .cookie-consent__slider {
    background: var(--cc-primary);
}

.cookie-consent__switch input:checked + .cookie-consent__slider::before {
    -webkit-transform: translateX(1.5rem);
    transform: translateX(1.5rem);
}

.cookie-consent__switch input:focus + .cookie-consent__slider {
    outline: 2px solid var(--cc-primary);
    outline-offset: 2px;
}

.cookie-consent__table-wrapper {
    overflow-x: auto;
    margin-top: 1rem;
}

.cookie-consent__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.cookie-consent__table th,
.cookie-consent__table td {
    padding: 0.625rem;
    text-align: left;
    border: 1px solid var(--cc-border);
}

.cookie-consent__table th {
    background: var(--cc-bg-alt);
    font-weight: 600;
    color: var(--cc-text);
}

.cookie-consent__table td {
    color: var(--cc-text-muted);
}

.cookie-consent__table code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.75rem;
    background: var(--cc-code-bg);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
}

/* Hidden views */
.cookie-consent__settings[hidden],
.cookie-consent__details[hidden] {
    display: none !important;
}

/* Responsive */
@media (max-width: 640px) {
    .cookie-consent {
        padding: 0;
    }

    .cookie-consent__container {
        max-height: 85vh;
        border-radius: 1rem 1rem 0 0;
    }

    .cookie-consent__actions {
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -ms-flex-direction: column;
        flex-direction: column;
        border-radius: 0;
    }

    .cookie-consent__btn {
        width: 100%;
    }

    .cookie-consent__category-header {
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -ms-flex-direction: column;
        flex-direction: column;
    }

    .cookie-consent__toggle {
        margin-top: 0.75rem;
    }
}
