/* ============================================
   Cookie Consent Banner & Settings Modal
   ============================================ */

/* Banner */
.consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    display: flex;
    justify-content: center;
    padding: 0 1rem 1.25rem;
    pointer-events: none;
    transform: translateY(100%);
    transition: transform 0.35s ease;
    visibility: hidden;
}

.consent-banner.is-visible {
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
}

.consent-banner__inner {
    width: 100%;
    max-width: var(--container-max, 1200px);
    background: var(--color-white, #fff);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.14), 0 0 0 1px rgba(0, 0, 0, 0.05);
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.consent-banner__text {
    flex: 1;
    min-width: 0;
}

.consent-banner__text strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 0.35rem;
    color: var(--color-text, #0b1220);
}

.consent-banner__text p {
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--color-text-secondary, #64748b);
    margin: 0;
}

.consent-banner__actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Buttons */
.consent-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.consent-btn--primary {
    background: var(--color-primary, #724fff);
    color: #fff;
}

.consent-btn--primary:hover {
    background: var(--color-primary-dark, #5c3de0);
}

.consent-btn--secondary {
    background: var(--color-bg, #f8fafc);
    color: var(--color-text, #0b1220);
    border: 1px solid var(--color-border-light, #e2e8f0);
}

.consent-btn--secondary:hover {
    background: var(--color-border-light, #e2e8f0);
}

.consent-btn--ghost {
    background: transparent;
    color: var(--color-primary, #724fff);
}

.consent-btn--ghost:hover {
    background: rgba(114, 79, 255, 0.08);
}

/* Modal */
.consent-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.25s, visibility 0.25s;
}

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

.consent-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

.consent-modal__dialog {
    position: relative;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    background: var(--color-white, #fff);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin: 1rem;
}

.consent-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--color-border-light, #e2e8f0);
}

.consent-modal__title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-text, #0b1220);
    margin: 0;
}

.consent-modal__close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-text-secondary, #64748b);
    cursor: pointer;
    border-radius: 6px;
    line-height: 1;
}

.consent-modal__close:hover {
    background: var(--color-bg, #f8fafc);
    color: var(--color-text, #0b1220);
}

.consent-modal__body {
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
}

.consent-modal__footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--color-border-light, #e2e8f0);
    display: flex;
    justify-content: flex-end;
}

/* Consent Category */
.consent-category {
    padding: 1rem 0;
    border-bottom: 1px solid var(--color-border-light, #e2e8f0);
}

.consent-category:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.consent-category:first-child {
    padding-top: 0;
}

.consent-category__desc {
    font-size: 0.8125rem;
    color: var(--color-text-secondary, #64748b);
    margin: 0.5rem 0 0 0;
    padding-left: 60px;
    line-height: 1.4;
}

/* Toggle Switch */
.consent-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.consent-toggle input {
    display: none;
}

.consent-toggle input:disabled ~ .consent-toggle__slider {
    opacity: 0.6;
    cursor: not-allowed;
}

.consent-toggle input:disabled ~ .consent-toggle__info {
    cursor: not-allowed;
}

.consent-toggle__slider {
    width: 48px;
    height: 26px;
    background: var(--color-border, #cbd5e1);
    border-radius: 13px;
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}

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

.consent-toggle input:checked + .consent-toggle__slider {
    background: var(--color-primary, #724fff);
}

.consent-toggle input:checked + .consent-toggle__slider::after {
    transform: translateX(22px);
}

.consent-toggle__info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.consent-toggle__name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-text, #0b1220);
}

.consent-toggle__badge {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-success, #16a34a);
    background: rgba(22, 163, 74, 0.1);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

.consent-toggle__detail {
    font-size: 0.8125rem;
    color: var(--color-text-secondary, #64748b);
}

/* Accordion */
.consent-category__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.consent-accordion__trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: none;
    border: 1px solid var(--color-border-light, #e2e8f0);
    border-radius: 6px;
    color: var(--color-text-secondary, #64748b);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

.consent-accordion__trigger:hover {
    background: var(--color-bg, #f8fafc);
    color: var(--color-text, #0b1220);
}

.consent-accordion__icon {
    transition: transform 0.25s ease;
}

.consent-accordion__trigger[aria-expanded="true"] .consent-accordion__icon {
    transform: rotate(180deg);
}

.consent-accordion__content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.consent-accordion__content[aria-hidden="false"] {
    max-height: 800px;
}

.consent-detail {
    margin-top: 0.875rem;
    padding: 0.875rem;
    background: var(--color-bg, #f8fafc);
    border-radius: 8px;
}

.consent-detail:first-child {
    margin-top: 1rem;
}

.consent-detail__heading {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text, #0b1220);
    margin: 0 0 0.5rem 0;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.consent-detail p {
    font-size: 0.8125rem;
    line-height: 1.55;
    color: var(--color-text-secondary, #64748b);
    margin: 0;
}

/* Cookie detail tables */
.consent-cookie-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    margin-bottom: 0.75rem;
}

.consent-cookie-table table:last-child {
    margin-bottom: 0;
}

.consent-cookie-table td {
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid var(--color-border-light, #e2e8f0);
    color: var(--color-text-secondary, #64748b);
    vertical-align: top;
    line-height: 1.4;
}

.consent-cookie-table tr:last-child td {
    border-bottom: none;
}

.consent-cookie-table__label {
    font-weight: 600;
    color: var(--color-text, #0b1220);
    white-space: nowrap;
    width: 120px;
}

.consent-cookie-table code {
    background: rgba(114, 79, 255, 0.08);
    color: var(--color-primary, #724fff);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    font-size: 0.8125rem;
    font-family: 'SF Mono', Consolas, monospace;
}

.consent-cookie-table a {
    color: var(--color-primary, #724fff);
    text-decoration: none;
    word-break: break-all;
}

.consent-cookie-table a:hover {
    text-decoration: underline;
}

/* Footer cookie link */
.footer-cookie-settings {
    cursor: pointer;
    background: none;
    border: none;
    font: inherit;
    color: inherit;
    padding: 0;
    text-decoration: none;
}

.footer-cookie-settings:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .consent-banner {
        padding: 0 0.5rem 0.5rem;
    }

    .consent-banner__inner {
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
        gap: 0.75rem;
        border-radius: 12px;
    }

    .consent-banner__text strong {
        font-size: 0.875rem;
        margin-bottom: 0.2rem;
    }

    .consent-banner__text p {
        font-size: 0.8125rem;
        line-height: 1.4;
    }

    .consent-banner__actions {
        flex-direction: column;
        gap: 0.375rem;
    }

    .consent-btn {
        width: 100%;
        padding: 0.6rem;
        font-size: 0.8125rem;
    }

    .consent-modal__dialog {
        max-width: 100%;
        border-radius: 12px 12px 0 0;
        margin: 0;
        position: absolute;
        bottom: 0;
    }

    .consent-category__desc {
        padding-left: 0;
        margin-top: 0.75rem;
    }
}
