/**
 * Sparkles Privacy Consent Banner
 * GDPR/CCPA compliant consent management
 * Extends: sparkles-utilities.css, sparkles-animations.css, sparkles-tokens.css
 * All 3 optimization layers applied: keyframes consolidated, patterns extracted, component organization
 */

/* ========== CONSENT BANNER ========== */
.sparkles-consent-banner,
.sparkles-banner-consent {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--white);
    box-shadow: 0 25px 50px -12px #00000040;
    border-top: 1px solid var(--gray-200);
    padding: 1rem;
    transform: translateY(100%);
    transition: transform .3s ease-out;
    z-index: var(--z-notification);
}

/* Container query anchors for consent modules */
:where(.sparkles-consent-banner, .sparkles-consent-modal) {
    container-type: inline-size;
}

.sparkles-consent-banner.show {
    --tw-translate-y: 0px;
}

.sparkles-consent-banner-content {
    max-width: 80rem;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.sparkles-consent-banner-text {
    flex: 1 1 0%;
}

.sparkles-consent-banner-title {
    color: var(--color-secondary);
    font-weight: 600;
    margin-bottom: .5rem;
}

.sparkles-consent-banner-description,
.sparkles-status-card-message,
.sparkles-newsletter-interest-text,
.sparkles-checkbox-item label {
    color: var(--gray-700);
    font-size: .875rem;
    line-height: 1.25rem;
}

.sparkles-consent-banner-actions {
    flex-wrap: wrap;
}

.sparkles-consent-btn {
    transition: none;
    animation: none;
    padding: .5rem 1rem;
    font-size: .875rem;
    line-height: 1.25rem;
}

.sparkles-consent-btn-accept,
.sparkles-btn-primary,
.sparkles-btn-brown,
.sparkles-btn-success,
.sparkles-btn-danger {
    --tw-text-opacity: 1;
    color: rgba(255, 255, 255, var(--tw-text-opacity, 1));
    --tw-shadow: var(--shadow-sm);
    --tw-shadow-colored: var(--shadow-sm);
}

.sparkles-consent-btn-accept,
.sparkles-btn-primary {
    background-color: var(--color-primary);
}

.sparkles-consent-btn-decline {
    --tw-text-opacity: 1;
    color: rgba(255, 255, 255, var(--tw-text-opacity, 1));
    --tw-shadow: var(--shadow-xs);
    --tw-shadow-colored: var(--shadow-xs);
    box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
    background-color: var(--color-secondary);
}

.sparkles-consent-btn-settings {
    border-radius: .125rem;
    background-color: initial;
    padding: .25rem .5rem;
    -webkit-text-decoration-line: underline;
    text-decoration-line: underline;
    text-underline-offset: 2px;
    color: var(--color-primary);
}

/* ========== CONSENT MODAL ========== */
.sparkles-consent-modal,
.sparkles-modal-backdrop,
.sparkles-lightbox {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: var(--z-modal-backdrop);
    display: flex;
    align-items: center;
    justify-content: center;
    --tw-bg-opacity: 1;
    background-color: rgba(0, 0, 0, var(--tw-bg-opacity, 1));
    padding: 1rem;
}

.sparkles-consent-modal {
    --tw-bg-opacity: 0.5;
}

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

.sparkles-consent-modal-dialog {
    position: relative;
    background-color: var(--white);
    border-radius: .75rem;
    box-shadow: var(--shadow-2xl);
    padding: 1.5rem;
    width: 100%;
    max-width: 42rem;
    margin: 2rem auto;
    transition: transform .3s ease-out;
    transform: scale(.95);
}

.sparkles-consent-modal.show .sparkles-consent-modal-dialog {
    transform: scale(1.0);
}

.sparkles-consent-modal-header,
.sparkles-import-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--sparkles-header-gap, 1rem);
    padding-bottom: 1rem;
    border-bottom-width: 1px;
    border-color: var(--gray-200);
}

.sparkles-consent-modal-title,
.sparkles-modal-title {
    color: var(--color-secondary);
    font-size: 1.25rem;
    line-height: 1.75rem;
    font-weight: 600;
    margin: 0;
}

.sparkles-consent-modal-close,
.sparkles-modal-close-button {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: .5rem;
    color: var(--gray-500);
    transition: color .2s ease-out, background-color .2s ease-out, border-color .2s ease-out;
}

.sparkles-consent-modal-body {
    margin-bottom: 1.5rem;
}

.sparkles-consent-section {
    margin-bottom: 1.5rem;
}

.sparkles-consent-section-title {
    font-size: 1.125rem;
    margin-bottom: .75rem;
}

/* ========== CONSENT TOGGLES ========== */
.sparkles-consent-toggle-group,
.sparkles-product-configurator,
.sparkles-recent-posts {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sparkles-consent-toggle {
    transition: all .3s ease-out;
    cursor: pointer;
}

.sparkles-consent-toggle.required {
    background-color: var(--color-accent);
    border-color: var(--color-primary);
}

.sparkles-consent-toggle-info {
    flex: 1 1 0%;
}

.sparkles-consent-toggle-description {
    font-size: .875rem;
    color: var(--gray-600);
    line-height: 1.625;
}

.sparkles-consent-toggle-required {
    color: var(--color-primary);
    font-size: .75rem;
    line-height: 1rem;
    font-weight: 500;
    margin-top: .25rem;
}

/* Toggle Switch */
.sparkles-toggle-switch,
.sparkles-toggle-base {
    position: relative;
    display: inline-block;
    width: 3rem;
    height: 1.5rem;
    background-color: var(--gray-300);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: color .2s ease-out, background-color .2s ease-out, border-color .2s ease-out;
}

.sparkles-toggle-switch.disabled {
    opacity: .5;
    cursor: not-allowed;
}

.sparkles-toggle-switch.active {
    background-color: var(--color-primary);
}

.sparkles-toggle-switch-thumb {
    border-width: 1px;
    border-style: solid;
}

.sparkles-toggle-switch.active .sparkles-toggle-switch-thumb {
    --tw-translate-x: 1.5rem;
}

/* ========== CONSENT STATUS INDICATOR ========== */
.sparkles-consent-status {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    background-color: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-full);
    padding: .75rem;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: all .2s ease-out;
}

.sparkles-consent-status:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-.25rem);
}

.sparkles-consent-status-icon {
    width: .5rem;
    height: .5rem;
    border-radius: var(--radius-full);
    --tw-bg-opacity: 1;
    background-color: var(--color-success);
}

.sparkles-consent-status-icon.partial {
    --tw-bg-opacity: 1;
    background-color: var(--color-warning);
}

.sparkles-consent-status-icon.none {
    --tw-bg-opacity: 1;
    background-color: var(--color-error);
}

/* ========== RESPONSIVE DESIGN ========== */
@container (max-width: 768px) {
    .sparkles-consent-banner-content {
        flex-direction: column;
        gap: .75rem;
    }

    .sparkles-consent-banner-actions {
        justify-content: center;
    }

    .sparkles-consent-modal {
        padding: .5rem;
    }

    .sparkles-consent-modal-dialog {
        max-height: 90vh;
        padding: 1rem;
    }

    .sparkles-consent-toggle {
        flex-direction: column;
        gap: .75rem;
    }

    .sparkles-consent-status {
        position: relative;
        margin-top: 1rem;
        margin-bottom: 1rem;
        margin-left: auto;
        margin-right: auto;
    }
}

/* ========== ACCESSIBILITY ========== */
.sparkles-consent-btn:focus,
.sparkles-toggle-switch:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--color-primary), 0 0 0 4px rgb(var(--color-primary-rgb)/.1);
}

.sparkles-consent-modal-close:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--color-primary), 0 0 0 3px rgb(var(--color-primary-rgb)/.1);
}

/* Screen reader only text - moved to social.css to avoid duplication */

/* High contrast mode support */
@media (prefers-contrast: high) {

    .sparkles-consent-banner,
    .sparkles-consent-modal-dialog,
    .sparkles-consent-toggle {
        border-width: 2px;
    }
}

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

    .sparkles-consent-banner,
    .sparkles-consent-modal,
    .sparkles-consent-modal-dialog,
    .sparkles-toggle-switch,
    .sparkles-toggle-switch-thumb {
        transition: none;
    }
}