/* ─── Maple Cookie Consent & Preferences System ─── */
/* Follows Maple's warm cream palette, Fraunces serif headings, and pill button styles */

:root {
    --cc-bg: var(--bg-elevated, #FDFAF5);
    --cc-border: var(--border-strong, #DFD5C4);
    --cc-text: var(--text, #1A1410);
    --cc-text-muted: var(--text-secondary, #7A6E63);
    --cc-text-subtle: var(--text-tertiary, #9A8E83);
    --cc-accent: var(--accent, #5A6E5C);
    --cc-radius: var(--radius-md, 20px);
    --cc-shadow: 0 16px 40px rgba(26, 20, 16, 0.12), 0 2px 10px rgba(26, 20, 16, 0.06);
}

/* ─── Bottom Floating Banner ─── */
.maple-cc-banner {
    position: fixed;
    bottom: 24px;
    left: 24px;
    right: 24px;
    max-width: 680px;
    margin: 0 auto;
    z-index: 1900;
    background: rgba(253, 250, 245, 0.95);
    backdrop-filter: blur(18px) saturate(180%);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    border: 1px solid var(--cc-border);
    border-radius: var(--cc-radius);
    padding: 24px 28px;
    box-shadow: var(--cc-shadow);
    color: var(--cc-text);
    font-family: var(--font, 'Inter', -apple-system, sans-serif);
    animation: mapleCcSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes mapleCcSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.maple-cc-banner.maple-cc-hiding {
    animation: mapleCcSlideDown 0.25s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes mapleCcSlideDown {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(20px);
    }
}

.maple-cc-banner-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.maple-cc-banner-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--cc-accent);
    background: rgba(90, 110, 92, 0.1);
    padding: 3px 10px;
    border-radius: 9999px;
    border: 1px solid rgba(90, 110, 92, 0.2);
}

.maple-cc-banner-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--cc-text);
    margin: 0;
    letter-spacing: -0.01em;
}

.maple-cc-banner-text {
    font-size: 14px;
    line-height: 1.55;
    color: var(--cc-text-muted);
    margin: 0 0 18px;
}

.maple-cc-banner-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.maple-cc-banner-actions .btn {
    padding: 9px 20px;
    font-size: 13.5px;
    font-weight: 500;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.maple-cc-btn-primary {
    background: var(--cc-text);
    color: #FDFAF5;
    border: 1px solid var(--cc-text);
}

.maple-cc-btn-primary:hover {
    background: #332A24;
    border-color: #332A24;
}

.maple-cc-btn-secondary {
    background: transparent;
    color: var(--cc-text);
    border: 1px solid var(--cc-border);
}

.maple-cc-btn-secondary:hover {
    background: rgba(26, 20, 16, 0.04);
    border-color: var(--cc-text);
}

.maple-cc-btn-link {
    background: transparent;
    border: none;
    color: var(--cc-text-muted);
    text-decoration: underline;
    text-underline-offset: 3px;
    padding: 9px 12px;
    font-size: 13.5px;
    cursor: pointer;
    font-family: inherit;
    margin-left: auto;
}

.maple-cc-btn-link:hover {
    color: var(--cc-text);
}

/* ─── Preferences Modal / Dialog ─── */
.maple-cc-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(18, 18, 17, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.maple-cc-modal-backdrop.maple-cc-open {
    opacity: 1;
    visibility: visible;
}

.maple-cc-modal-card {
    background: var(--cc-bg);
    border: 1px solid var(--cc-border);
    border-radius: var(--cc-radius);
    max-width: 620px;
    width: 100%;
    max-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    box-shadow: var(--cc-shadow);
    color: var(--cc-text);
    transform: translateY(16px) scale(0.98);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.maple-cc-modal-backdrop.maple-cc-open .maple-cc-modal-card {
    transform: translateY(0) scale(1);
}

.maple-cc-modal-header {
    padding: 24px 28px 18px;
    border-bottom: 1px solid var(--border, #E8E0D0);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    background: var(--cc-bg);
}

.maple-cc-modal-title {
    font-family: var(--font-serif, 'Fraunces', serif);
    font-size: 24px;
    font-weight: 400;
    letter-spacing: -0.015em;
    margin: 0 0 6px;
    color: var(--cc-text);
}

.maple-cc-modal-subtitle {
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--cc-text-muted);
    margin: 0;
}

.maple-cc-modal-close {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 9999px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--cc-text-muted);
    padding: 0;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.maple-cc-modal-close:hover {
    background: rgba(26, 20, 16, 0.05);
    color: var(--cc-text);
    border-color: var(--cc-border);
}

.maple-cc-modal-body {
    padding: 20px 28px;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Category card */
.maple-cc-category-card {
    background: rgba(245, 240, 232, 0.45);
    border: 1px solid var(--border, #E8E0D0);
    border-radius: var(--radius-sm, 12px);
    padding: 18px 20px;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.maple-cc-category-card:hover {
    border-color: var(--cc-border);
    background: rgba(245, 240, 232, 0.7);
}

.maple-cc-category-card.is-required {
    background: rgba(90, 110, 92, 0.04);
    border-color: rgba(90, 110, 92, 0.2);
}

.maple-cc-cat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 8px;
}

.maple-cc-cat-label-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.maple-cc-cat-name {
    font-size: 15.5px;
    font-weight: 600;
    color: var(--cc-text);
    letter-spacing: -0.01em;
}

.maple-cc-pill-required {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--cc-accent);
    background: rgba(90, 110, 92, 0.12);
    border: 1px solid rgba(90, 110, 92, 0.25);
    padding: 2px 8px;
    border-radius: 9999px;
}

.maple-cc-pill-status {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--cc-text-subtle);
    background: rgba(26, 20, 16, 0.05);
    padding: 2px 8px;
    border-radius: 9999px;
}

.maple-cc-cat-desc {
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--cc-text-muted);
    margin: 0;
}

.maple-cc-cat-meta {
    font-size: 12px;
    color: var(--cc-text-subtle);
    margin-top: 8px;
    line-height: 1.45;
}

/* Accessible Toggle Switch */
.maple-cc-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    cursor: pointer;
}

.maple-cc-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.maple-cc-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #D1C7B7;
    transition: background-color 0.25s ease;
    border-radius: 9999px;
}

.maple-cc-slider::before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: #FDFAF5;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.maple-cc-switch input:checked + .maple-cc-slider {
    background-color: var(--cc-accent);
}

.maple-cc-switch input:checked + .maple-cc-slider::before {
    transform: translateX(20px);
}

.maple-cc-switch input:disabled + .maple-cc-slider {
    background-color: #8E9B90;
    opacity: 0.7;
    cursor: not-allowed;
}

.maple-cc-switch input:focus-visible + .maple-cc-slider {
    outline: 2px solid var(--cc-accent);
    outline-offset: 2px;
}

/* Links inside modal */
.maple-cc-legal-links {
    font-size: 12.5px;
    color: var(--cc-text-muted);
    display: flex;
    gap: 16px;
    padding-top: 6px;
    border-top: 1px solid var(--border, #E8E0D0);
}

.maple-cc-legal-links a {
    color: var(--cc-accent);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: opacity 0.2s ease;
}

.maple-cc-legal-links a:hover {
    opacity: 0.8;
}

/* Modal Footer */
.maple-cc-modal-footer {
    padding: 18px 28px 24px;
    border-top: 1px solid var(--border, #E8E0D0);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    background: var(--cc-bg);
}

.maple-cc-modal-footer-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.maple-cc-modal-footer-right {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .maple-cc-banner {
        bottom: 12px;
        left: 12px;
        right: 12px;
        padding: 20px;
    }
    
    .maple-cc-banner-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .maple-cc-banner-actions .btn {
        width: 100%;
        text-align: center;
    }

    .maple-cc-btn-link {
        text-align: center;
        margin-left: 0;
    }

    .maple-cc-modal-card {
        max-height: calc(100vh - 24px);
    }

    .maple-cc-modal-header,
    .maple-cc-modal-body,
    .maple-cc-modal-footer {
        padding-left: 18px;
        padding-right: 18px;
    }

    .maple-cc-modal-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .maple-cc-modal-footer-left,
    .maple-cc-modal-footer-right {
        width: 100%;
        margin-left: 0;
        flex-direction: column;
    }

    .maple-cc-modal-footer button {
        width: 100%;
    }
}

/* Respect user reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
    .maple-cc-banner,
    .maple-cc-banner.maple-cc-hiding,
    .maple-cc-modal-card,
    .maple-cc-modal-backdrop,
    .maple-cc-slider::before {
        animation: none !important;
        transition: none !important;
    }
}
