/* =============================================================================
   BOOKY AI — Cookie Consent & US Privacy Choices CSS
   Built with Booky AI Design System Tokens (colors.css, btn.css, cards.css, forms.css)
   Compliant with California CCPA / CPRA, Colorado CPA, Virginia VCDPA & US State Laws
   ============================================================================= */

/* =============================================================================
   1. Floating Corner Card (Linear / Stripe inspired modern aesthetic)
   ============================================================================= */

.booky-cookie-card {
    position: fixed;
    bottom: 24px;
    left: 24px;
    width: 440px;
    max-width: calc(100vw - 32px);
    z-index: 99998;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--border-default, #e2e8f0);
    border-radius: var(--radius-xl, 16px);
    box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.14), 0 0 0 1px rgba(0, 0, 0, 0.03);
    padding: 20px 22px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transform: translateY(30px) scale(0.97);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, border-color var(--transition-base, 200ms ease);
}

[data-bs-theme="dark"] .booky-cookie-card,
body.theme-dark .booky-cookie-card {
    background: rgba(26, 26, 26, 0.94);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.booky-cookie-card.is-visible {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

.booky-cookie-card:hover {
    border-color: rgba(var(--brand-rgb, 16, 185, 129), 0.35);
}

/* --- Card Header --- */
.cookie-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.cookie-card-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cookie-shield-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md, 8px);
    background: rgba(var(--brand-rgb, 16, 185, 129), 0.12);
    color: var(--brand, #10b981);
    border: 1px solid rgba(var(--brand-rgb, 16, 185, 129), 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
}

[data-bs-theme="dark"] .cookie-shield-icon,
body.theme-dark .cookie-shield-icon {
    background: rgba(var(--brand-rgb, 16, 185, 129), 0.18);
    color: var(--brand-light, #34d399);
    border-color: rgba(var(--brand-rgb, 16, 185, 129), 0.35);
}

.cookie-header-text {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.cookie-card-title {
    font-family: 'Outfit', sans-serif;
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text-primary, #111827);
    margin: 0;
    letter-spacing: -0.01em;
}

[data-bs-theme="dark"] .cookie-card-title,
body.theme-dark .cookie-card-title {
    color: #f9fafb;
}

.cookie-pill-badge {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 7px;
    border-radius: var(--radius-full, 9999px);
    background: rgba(var(--brand-rgb, 16, 185, 129), 0.1);
    color: var(--brand, #0c7e4f);
    border: 1px solid rgba(var(--brand-rgb, 16, 185, 129), 0.25);
}

[data-bs-theme="dark"] .cookie-pill-badge,
body.theme-dark .cookie-pill-badge {
    background: rgba(52, 211, 153, 0.14);
    color: var(--color-green-300, #6ee7b7);
    border-color: rgba(52, 211, 153, 0.3);
}

.cookie-close-btn {
    background: transparent;
    border: none;
    padding: 4px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm, 6px);
    color: var(--text-muted, #94a3b8);
    cursor: pointer;
    transition: all var(--transition-fast, 150ms ease);
}

.cookie-close-btn:hover {
    background: var(--bg-card-raised, #f1f5f9);
    color: var(--text-primary, #111827);
}

[data-bs-theme="dark"] .cookie-close-btn:hover,
body.theme-dark .cookie-close-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #f9fafb;
}

/* --- Card Body --- */
.cookie-card-body {
    margin-bottom: 16px;
}

.cookie-card-text {
    font-size: 0.84rem;
    line-height: 1.5;
    color: var(--text-secondary, #475569);
    margin: 0 0 8px 0;
}

[data-bs-theme="dark"] .cookie-card-text,
body.theme-dark .cookie-card-text {
    color: #cbd5e1;
}

.cookie-legal-links {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
}

.cookie-link {
    color: var(--brand, #10b981);
    text-decoration: none !important;
    font-weight: 500;
    transition: color var(--transition-fast, 150ms ease);
}

.cookie-link:hover {
    color: var(--brand-dark, #065f3a);
    text-decoration: underline !important;
}

[data-bs-theme="dark"] .cookie-link {
    color: var(--brand-light, #34d399);
}

[data-bs-theme="dark"] .cookie-link:hover {
    color: var(--color-green-200, #a7f3d0);
}

.cookie-dot-separator {
    color: var(--border-default, #cbd5e1);
    font-size: 0.7rem;
}

/* --- Card Actions (Matches btn.css tokens) --- */
.cookie-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.cookie-card-actions .btn {
    font-size: 0.8125rem;
    padding: 0.45rem 1rem;
    border-radius: var(--radius-md, 8px);
    font-weight: 600;
}

.cookie-card-actions #btnCookieAcceptAll {
    background-color: var(--brand, #10b981);
    border-color: var(--brand-dark, #059669);
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(var(--brand-rgb, 16, 185, 129), 0.25);
}

.cookie-card-actions #btnCookieAcceptAll:hover {
    background-color: var(--brand-dark, #059669);
    border-color: var(--brand-dark, #059669);
    box-shadow: 0 4px 12px rgba(var(--brand-rgb, 16, 185, 129), 0.35);
    transform: translateY(-1px);
}

.cookie-card-actions #btnCookieReject {
    background-color: transparent;
    border-color: var(--border-default, #e2e8f0);
    color: var(--text-secondary, #475569) !important;
}

.cookie-card-actions #btnCookieReject:hover {
    background-color: var(--bg-card-raised, #f1f5f9);
    border-color: var(--border-strong, #cbd5e1);
    color: var(--text-primary, #111827) !important;
}

[data-bs-theme="dark"] .cookie-card-actions #btnCookieReject {
    border-color: rgba(255, 255, 255, 0.12);
    color: #cbd5e1 !important;
}

[data-bs-theme="dark"] .cookie-card-actions #btnCookieReject:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff !important;
}

.cookie-card-actions #btnCookieOpenPrefs {
    background-color: transparent;
    border-color: transparent;
    color: var(--brand, #10b981) !important;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.cookie-card-actions #btnCookieOpenPrefs:hover {
    background-color: rgba(var(--brand-rgb, 16, 185, 129), 0.08);
}

[data-bs-theme="dark"] .cookie-card-actions #btnCookieOpenPrefs {
    color: var(--brand-light, #34d399) !important;
}

/* =============================================================================
   2. Floating "Your Privacy Choices" Trigger Pill
   ============================================================================= */

.booky-privacy-choice-pill {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 99990;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--border-default, #e2e8f0);
    color: var(--text-secondary, #475569);
    padding: 6px 12px;
    border-radius: var(--radius-full, 9999px);
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all var(--transition-base, 200ms ease);
}

[data-bs-theme="dark"] .booky-privacy-choice-pill,
body.theme-dark .booky-privacy-choice-pill {
    background: rgba(26, 26, 26, 0.92);
    border-color: rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
}

.booky-privacy-choice-pill i {
    color: var(--brand, #10b981);
    font-size: 0.82rem;
    transition: transform var(--transition-fast, 150ms ease);
}

[data-bs-theme="dark"] .booky-privacy-choice-pill i {
    color: var(--brand-light, #34d399);
}

.booky-privacy-choice-pill:hover {
    transform: translateY(-2px);
    border-color: rgba(var(--brand-rgb, 16, 185, 129), 0.4);
    color: var(--text-primary, #111827);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.booky-privacy-choice-pill:hover i {
    transform: scale(1.1);
}

[data-bs-theme="dark"] .booky-privacy-choice-pill:hover {
    color: #ffffff;
    border-color: rgba(var(--brand-rgb, 16, 185, 129), 0.5);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.6);
}

/* Hide trigger while the banner is on screen */
body.cookie-banner-active .booky-privacy-choice-pill {
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
}

/* Footer link button */
.footer-privacy-choice-btn {
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
    font-family: inherit;
    color: inherit;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color var(--transition-fast, 150ms ease);
}

.footer-privacy-choice-btn:hover {
    color: var(--brand, #10b981);
}

[data-bs-theme="dark"] .footer-privacy-choice-btn:hover {
    color: var(--brand-light, #34d399);
}

/* =============================================================================
   3. Cookie Preferences Modal (Executive Privacy Center)
   ============================================================================= */

.cookie-modal .modal-dialog {
    max-width: 620px;
}

.cookie-modal .modal-content {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-default, #e2e8f0);
    border-radius: var(--radius-xl, 16px);
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.22);
    overflow: hidden;
}

[data-bs-theme="dark"] .cookie-modal .modal-content,
body.theme-dark .cookie-modal .modal-content {
    background: rgba(20, 20, 20, 0.98);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 30px 70px -15px rgba(0, 0, 0, 0.75);
}

.cookie-modal .modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border-default, #e2e8f0);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

[data-bs-theme="dark"] .cookie-modal .modal-header,
body.theme-dark .cookie-modal .modal-header {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.cookie-modal .modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary, #111827);
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Outfit', sans-serif;
}

[data-bs-theme="dark"] .cookie-modal .modal-title,
body.theme-dark .cookie-modal .modal-title {
    color: #f9fafb;
}

.cookie-modal .btn-close {
    font-size: 0.8rem;
    opacity: 0.6;
    transition: opacity var(--transition-fast, 150ms ease);
}

.cookie-modal .btn-close:hover {
    opacity: 1;
}

[data-bs-theme="dark"] .cookie-modal .btn-close {
    filter: invert(1);
}

.cookie-modal .modal-body {
    padding: 20px 24px;
    max-height: 60vh;
    overflow-y: auto;
}

/* Custom scrollbar */
.cookie-modal .modal-body::-webkit-scrollbar {
    width: 6px;
}
.cookie-modal .modal-body::-webkit-scrollbar-track {
    background: transparent;
}
.cookie-modal .modal-body::-webkit-scrollbar-thumb {
    background: var(--border-strong, #cbd5e1);
    border-radius: var(--radius-full, 9999px);
}
[data-bs-theme="dark"] .cookie-modal .modal-body::-webkit-scrollbar-thumb {
    background: #3a3a3a;
}

.cookie-modal .modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-default, #e2e8f0);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: rgba(0, 0, 0, 0.015);
}

[data-bs-theme="dark"] .cookie-modal .modal-footer,
body.theme-dark .cookie-modal .modal-footer {
    border-top-color: rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.015);
}

/* --- GPC Detection Banner in Modal --- */
.gpc-detected-banner {
    display: none;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-md, 8px);
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.25);
    margin-bottom: 16px;
    font-size: 0.82rem;
    line-height: 1.45;
    color: #1d4ed8;
}

[data-bs-theme="dark"] .gpc-detected-banner,
body.theme-dark .gpc-detected-banner {
    background: rgba(59, 130, 246, 0.14);
    border-color: rgba(96, 165, 250, 0.3);
    color: #93c5fd;
}

.gpc-detected-banner.is-active {
    display: flex;
}

.gpc-detected-banner i {
    font-size: 1rem;
    color: #3b82f6;
    margin-top: 2px;
    flex-shrink: 0;
}

/* --- Modal Category Cards --- */
.cookie-cat-card {
    background: var(--bg-page, #faf9f6);
    border: 1px solid var(--border-default, #e2e8f0);
    border-radius: var(--radius-lg, 12px);
    padding: 16px 18px;
    margin-bottom: 12px;
    transition: border-color var(--transition-fast, 150ms ease);
}

[data-bs-theme="dark"] .cookie-cat-card,
body.theme-dark .cookie-cat-card {
    background: rgba(30, 30, 30, 0.6);
    border-color: rgba(255, 255, 255, 0.08);
}

.cookie-cat-card:hover {
    border-color: rgba(var(--brand-rgb, 16, 185, 129), 0.35);
}

.cookie-cat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.cookie-cat-name {
    font-size: 0.92rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary, #111827);
    display: flex;
    align-items: center;
    gap: 8px;
}

[data-bs-theme="dark"] .cookie-cat-name,
body.theme-dark .cookie-cat-name {
    color: #f1f5f9;
}

.cookie-cat-badge-always {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full, 9999px);
    background: rgba(var(--brand-rgb, 16, 185, 129), 0.12);
    color: var(--brand, #0c7e4f);
    border: 1px solid rgba(var(--brand-rgb, 16, 185, 129), 0.25);
}

[data-bs-theme="dark"] .cookie-cat-badge-always,
body.theme-dark .cookie-cat-badge-always {
    background: rgba(52, 211, 153, 0.15);
    color: var(--color-green-300, #6ee7b7);
    border-color: rgba(52, 211, 153, 0.3);
}

.cookie-cat-desc {
    font-size: 0.81rem;
    line-height: 1.5;
    color: var(--text-secondary, #64748b);
    margin: 0 0 8px 0;
}

[data-bs-theme="dark"] .cookie-cat-desc,
body.theme-dark .cookie-cat-desc {
    color: #94a3b8;
}

.cookie-cat-cookies {
    font-size: 0.75rem;
    color: var(--text-muted, #94a3b8);
    display: inline-block;
}

.cookie-cat-cookies code {
    background: rgba(0, 0, 0, 0.04);
    color: var(--brand-dark, #0c7e4f);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.72rem;
}

[data-bs-theme="dark"] .cookie-cat-cookies code {
    background: rgba(255, 255, 255, 0.06);
    color: var(--brand-light, #34d399);
}

/* --- Switch Toggle (forms.css style) --- */
.booky-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}

.booky-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.booky-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-strong, #cbd5e1);
    transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 22px;
}

[data-bs-theme="dark"] .booky-slider,
body.theme-dark .booky-slider {
    background-color: #444444;
}

.booky-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.booky-switch input:checked + .booky-slider {
    background-color: var(--brand, #10b981);
}

.booky-switch input:focus-visible + .booky-slider {
    box-shadow: var(--shadow-focus, 0 0 0 3px rgba(16, 185, 129, 0.3));
}

.booky-switch input:checked + .booky-slider:before {
    transform: translateX(18px);
}

.booky-switch input:disabled + .booky-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* =============================================================================
   4. Mobile Responsiveness
   ============================================================================= */

@media (max-width: 540px) {
    .booky-cookie-card {
        bottom: 12px;
        right: 12px;
        left: 12px;
        width: auto;
        padding: 16px 18px;
    }

    .cookie-card-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .cookie-card-actions #btnCookieOpenPrefs {
        grid-column: span 2;
        text-align: center;
        padding: 4px;
    }

    .booky-privacy-choice-pill {
        bottom: 14px;
        left: 14px;
        padding: 5px 10px;
    }

    .cookie-modal .modal-footer {
        flex-direction: column-reverse;
        gap: 8px;
    }

    .cookie-modal .modal-footer > * {
        width: 100%;
    }
}
