/**
 * We Have Cookies – Banner & Preference Center Styles
 *
 * Uses CSS custom properties injected by PHP for admin-configurable colors:
 * --wac-bg, --wac-text, --wac-btn-pri-bg, --wac-btn-pri-text,
 * --wac-btn-sec-bg, --wac-btn-sec-text
 *
 * @package WeAreCookie
 */

/* ─── Reset ─── */
.wac-banner *,
.wac-overlay *,
.wac-ccpa-footer * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter Tight', sans-serif;
}

/* ─── Banner Container ─── */
.wac-banner {
    position: fixed;
    z-index: 999999;
    background: var(--wac-bg, #ffffff);
    color: var(--wac-text, #1d1d1f);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    border-top: 1px solid color-mix(in srgb, currentColor 15%, transparent);
    animation: wacSlideIn 0.35s ease-out;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {

    .wac-banner,
    .wac-overlay,
    .wac-overlay__panel {
        animation: none !important;
        transition: none !important;
    }
}

/* ─── Layout Variants ─── */
.wac-banner--bottom-bar {
    bottom: 0;
    left: 0;
    right: 0;
}

.wac-banner--top-bar {
    top: 0;
    left: 0;
    right: 0;
    border-top: none;
    border-bottom: 1px solid color-mix(in srgb, currentColor 15%, transparent);
}

.wac-banner--modal {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 520px;
    width: 90%;
    flex-direction: column;
    text-align: center;
    padding: 32px;
    border: 1px solid color-mix(in srgb, currentColor 15%, transparent);
    border-top: 1px solid color-mix(in srgb, currentColor 15%, transparent);
    animation: wacFadeIn 0.3s ease-out;
}

.wac-banner--chip {
    bottom: 20px;
    right: 20px;
    left: auto;
    max-width: 380px;
    flex-direction: column;
    padding: 20px;
    border: 1px solid color-mix(in srgb, currentColor 15%, transparent);
    border-top: 1px solid color-mix(in srgb, currentColor 15%, transparent);
    animation: wacFadeIn 0.3s ease-out;
}

/* ─── Banner Content ─── */
.wac-banner__content {
    flex: 1;
}

.wac-banner__heading {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 6px;
    line-height: 1.3;
}

.wac-banner__text {
    font-size: 13px;
    line-height: 1.5;
    opacity: 0.9;
}

.wac-banner__text a {
    color: var(--wac-btn-pri-bg, #000000);
    text-decoration: underline;
}

.wac-banner__text a:hover {
    opacity: 0.8;
}

/* ─── Button Group ─── */
.wac-banner__actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.wac-banner--modal .wac-banner__actions,
.wac-banner--chip .wac-banner__actions {
    width: 100%;
    justify-content: center;
}

/* ─── Buttons ─── */
.wac-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.2s;
    text-decoration: none;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.wac-btn:hover {
    opacity: 0.85;
}

.wac-btn:focus-visible {
    outline: 2px solid var(--wac-btn-pri-bg, #000000);
    outline-offset: 2px;
}

.wac-btn--primary {
    background: var(--wac-btn-pri-bg, #000000);
    color: var(--wac-btn-pri-text, #ffffff);
}

.wac-btn--secondary {
    background: var(--wac-btn-sec-bg, transparent);
    color: var(--wac-btn-sec-text, #000000);
    border: 1px solid var(--wac-btn-sec-text, #000000);
}

.wac-btn--link {
    background: transparent;
    color: var(--wac-text, #1d1d1f);
    border: none;
    padding: 10px 12px;
    text-decoration: underline;
    opacity: 0.7;
}

.wac-btn--link:hover {
    opacity: 1;
}

/* ─── Overlay / Preference Center ─── */
.wac-overlay {
    position: fixed;
    z-index: 1000000;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: wacFadeIn 0.25s ease-out;
}

.wac-overlay[aria-hidden="true"] {
    display: none;
}

.wac-overlay__panel {
    background: var(--wac-bg, #ffffff);
    color: var(--wac-text, #1d1d1f);
    max-width: 560px;
    width: 92%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    border: 1px solid color-mix(in srgb, currentColor 15%, transparent);
    animation: wacSlideUp 0.3s ease-out;
}

.wac-overlay__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 32px 32px 0 32px;
    margin-bottom: 16px;
    flex-shrink: 0;
}

.wac-overlay__body {
    flex: 1;
    overflow-y: auto;
    padding: 0 32px;
    min-height: 0;
}

.wac-overlay__title {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
}

.wac-overlay__close {
    background: transparent;
    border: none;
    color: var(--wac-text, #1d1d1f);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    opacity: 0.7;
    transition: opacity 0.2s;
    line-height: 1;
}

.wac-overlay__close:hover {
    opacity: 1;
}

.wac-overlay__close:focus-visible {
    outline: 2px solid var(--wac-btn-pri-bg, #000000);
    outline-offset: 2px;
}

.wac-overlay__desc {
    font-size: 13px;
    line-height: 1.6;
    opacity: 0.85;
    margin-bottom: 24px;
}

.wac-overlay__footer {
    padding: 16px 32px;
    border-top: 1px solid color-mix(in srgb, currentColor 10%, transparent);
    flex-shrink: 0;
}

/* ─── Category Toggle ─── */
.wac-category {
    border: 1px solid color-mix(in srgb, currentColor 15%, transparent);
    padding: 16px;
    margin-bottom: 12px;
}

.wac-category__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.wac-category__label {
    font-size: 14px;
    font-weight: 600;
}

.wac-category__required {
    font-size: 11px;
    opacity: 0.6;
    font-weight: 400;
}

.wac-category__desc {
    font-size: 12px;
    line-height: 1.5;
    opacity: 0.7;
    margin-top: 8px;
}

.wac-category__services {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.wac-category__services-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.5;
    margin-bottom: 8px;
}

.wac-service-item {
    margin-bottom: 8px;
}

.wac-service-item:last-child {
    margin-bottom: 0;
}

.wac-service-item__name {
    font-size: 13px;
    font-weight: 600;
}

.wac-service-item__purpose {
    font-size: 11px;
    opacity: 0.6;
    margin-top: 2px;
}

/* Toggle switch */
.wac-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.wac-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.wac-toggle__slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #d1d5db;
    border-radius: 24px;
    transition: background-color 0.25s;
}

.wac-toggle__slider::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.25s;
}

.wac-toggle input:checked+.wac-toggle__slider {
    background: var(--wac-btn-pri-bg, #000000);
}

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

.wac-toggle input:focus-visible+.wac-toggle__slider {
    outline: 2px solid var(--wac-btn-pri-bg, #000000);
    outline-offset: 2px;
}

.wac-toggle input:disabled+.wac-toggle__slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ─── Overlay Footer ─── */
.wac-overlay__footer {
    margin-top: 20px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ─── CCPA Section in Preferences ─── */
.wac-ccpa-section {
    border: 1px solid color-mix(in srgb, currentColor 15%, transparent);
    padding: 16px;
    margin-bottom: 12px;
    background: rgba(255, 165, 0, 0.06);
}

.wac-ccpa-section__title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.wac-ccpa-section__desc {
    font-size: 12px;
    opacity: 0.7;
    margin-bottom: 12px;
}

/* ─── CCPA Footer Link ─── */
.wac-ccpa-footer {
    text-align: center;
    padding: 10px;
}

.wac-ccpa-link {
    font-size: 13px;
    color: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.wac-ccpa-link:hover {
    opacity: 0.8;
}

/* ─── Iframe Placeholder ─── */
.wac-iframe-placeholder {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    background: #f0f0f1;
    color: #333;
    padding: 32px;
    min-height: 200px;
    text-align: center;
}

.wac-iframe-placeholder__icon {
    font-size: 32px;
}

.wac-iframe-placeholder__text {
    font-size: 14px;
    max-width: 320px;
}

.wac-iframe-placeholder__btn {
    padding: 8px 20px;
    background: #000;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}

.wac-iframe-placeholder__btn:hover {
    opacity: 0.85;
}

/* ─── Policy Table (shortcode) ─── */
.wac-policy-tables {
    margin: 20px 0;
}

.wac-policy-category {
    margin-bottom: 28px;
}

.wac-policy-category__title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.wac-policy-category__desc {
    color: #666;
    margin-bottom: 12px;
    font-size: 14px;
}

.wac-policy-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 8px;
}

.wac-policy-table th,
.wac-policy-table td {
    border: 1px solid #ddd;
    padding: 8px 12px;
    text-align: left;
    font-size: 13px;
}

.wac-policy-table th {
    background: #f7f7f7;
    font-weight: 600;
}

.wac-policy-no-cookies {
    color: #888;
    font-size: 13px;
}

/* ─── Preferences Button (shortcode) ─── */
.wac-preferences-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #000;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}

.wac-preferences-btn:hover {
    opacity: 0.85;
}

/* ─── Animations ─── */
@keyframes wacSlideIn {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes wacFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes wacSlideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ─── Top bar slide variant ─── */
.wac-banner--top-bar {
    animation: wacSlideDown 0.35s ease-out;
}

@keyframes wacSlideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .wac-banner {
        flex-direction: column;
        text-align: center;
        padding: 16px;
        gap: 12px;
    }

    .wac-banner__actions {
        width: 100%;
        justify-content: center;
    }

    .wac-btn {
        flex: 1;
        min-width: 0;
        padding: 10px 14px;
        font-size: 12px;
    }

    .wac-overlay__panel {
        padding: 20px;
        max-height: 90vh;
        width: 96%;
    }
}