/* ==========================================================================
   UP Creative - Cookie Consent Banner & Modal (GDPR / ePrivacy Compliant)
   Aesthetic: Dark Glassmorphism, GPU Accelerated, High Contrast, Responsive
   ========================================================================== */

:root {
    --up-cookie-bg: rgba(15, 23, 42, 0.94);
    --up-cookie-bg-card: rgba(30, 41, 59, 0.7);
    --up-cookie-border: rgba(255, 255, 255, 0.12);
    --up-cookie-text: #f8fafc;
    --up-cookie-text-muted: #94a3b8;
    --up-cookie-primary: #ff5722;
    --up-cookie-primary-hover: #f4511e;
    --up-cookie-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* 1. Main Cookie Banner Container (Floating Bottom Dock) */
.up-cookie-banner {
    position: fixed;
    bottom: 24px;
    left: 24px;
    right: 24px;
    max-width: 580px;
    margin: 0 auto 0 0;
    background: var(--up-cookie-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--up-cookie-border);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
    z-index: 99999;
    font-family: var(--up-cookie-font);
    color: var(--up-cookie-text);
    opacity: 0;
    transform: translateY(40px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

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

.up-cookie-icon-wrapper {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255, 87, 34, 0.12);
    color: var(--up-cookie-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.up-cookie-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    color: #ffffff;
    letter-spacing: -0.01em;
}

.up-cookie-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Banner Text */
.up-cookie-desc {
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--up-cookie-text-muted);
    margin: 0 0 18px 0;
}

.up-cookie-desc a {
    color: #ff7043;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.2s ease;
}

.up-cookie-desc a:hover {
    color: #ffab91;
}

/* Banner Actions (No Dark Patterns: Clear, High-Contrast Options) */
.up-cookie-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.up-cookie-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: var(--up-cookie-font);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    text-decoration: none;
    line-height: 1.2;
    flex: 1 1 auto;
    text-align: center;
}

/* Primary Button: Accetta tutti */
.up-cookie-btn-primary {
    background: linear-gradient(135deg, #ff5722 0%, #f4511e 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(255, 87, 34, 0.3);
}

.up-cookie-btn-primary:hover {
    background: linear-gradient(135deg, #f4511e 0%, #e64a19 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(255, 87, 34, 0.4);
    color: #ffffff;
}

/* Secondary Button: Solo necessari (Equal weight & high contrast) */
.up-cookie-btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

.up-cookie-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.28);
    color: #ffffff;
    transform: translateY(-1px);
}

/* Tertiary Button: Personalizza */
.up-cookie-btn-outline {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.14);
    color: #cbd5e1;
}

.up-cookie-btn-outline:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

/* ==========================================================================
   2. Cookie Preferences Modal (Granular Settings)
   ========================================================================== */
.up-cookie-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(8, 6, 12, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.up-cookie-modal-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

.up-cookie-modal-dialog {
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    background: #0f172a;
    border: 1px solid var(--up-cookie-border);
    border-radius: 20px;
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.94) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: var(--up-cookie-font);
}

.up-cookie-modal-backdrop.is-open .up-cookie-modal-dialog {
    transform: scale(1) translateY(0);
}

.up-cookie-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.up-cookie-modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.up-cookie-modal-close {
    background: transparent;
    border: none;
    color: var(--up-cookie-text-muted);
    font-size: 1.25rem;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.up-cookie-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.up-cookie-modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.up-cookie-intro-text {
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--up-cookie-text-muted);
    margin-bottom: 20px;
}

/* Category Cards */
.up-cookie-category-item {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 14px;
    transition: border-color 0.2s ease;
}

.up-cookie-category-item:last-child {
    margin-bottom: 0;
}

.up-cookie-category-item:hover {
    border-color: rgba(255, 255, 255, 0.18);
}

.up-cookie-category-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.up-cookie-category-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.up-cookie-tag {
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.up-cookie-tag-required {
    background: rgba(16, 185, 129, 0.16);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.up-cookie-category-desc {
    font-size: 0.84rem;
    line-height: 1.5;
    color: var(--up-cookie-text-muted);
    margin: 0;
}

/* Custom Switch Toggle */
.up-cookie-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

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

.up-cookie-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: rgba(255, 255, 255, 0.18);
    border-radius: 24px;
    transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.up-cookie-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: #ffffff;
    border-radius: 50%;
    transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.up-cookie-switch input:checked + .up-cookie-slider {
    background-color: var(--up-cookie-primary);
}

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

.up-cookie-switch input:disabled + .up-cookie-slider {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #10b981;
}

.up-cookie-switch input:disabled + .up-cookie-slider:before {
    transform: translateX(20px);
}

/* Modal Footer */
.up-cookie-modal-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(15, 23, 42, 0.6);
}

/* ==========================================================================
   3. Floating Revisit Trigger Badge (Revocability / Modifica Consenso)
   ========================================================================== */
.up-cookie-revisit-badge {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 9998;
    background: rgba(15, 23, 42, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #cbd5e1;
    border-radius: 30px;
    padding: 8px 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--up-cookie-font);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.35);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    pointer-events: none;
}

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

.up-cookie-revisit-badge:hover {
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(255, 87, 34, 0.5);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 12px 28px -5px rgba(255, 87, 34, 0.2);
}

.up-cookie-revisit-badge i {
    color: var(--up-cookie-primary);
    font-size: 0.9rem;
}

/* ==========================================================================
   4. Mobile Responsiveness
   ========================================================================== */
@media (max-width: 640px) {
    .up-cookie-banner {
        left: 14px;
        right: 14px;
        bottom: 14px;
        max-width: calc(100% - 28px);
        padding: 18px;
        border-radius: 16px;
    }

    .up-cookie-title {
        font-size: 0.98rem;
    }

    .up-cookie-actions {
        flex-direction: column;
        width: 100%;
    }

    .up-cookie-btn {
        width: 100%;
    }

    .up-cookie-modal-dialog {
        max-height: 94vh;
        border-radius: 16px;
    }

    .up-cookie-modal-header,
    .up-cookie-modal-body,
    .up-cookie-modal-footer {
        padding: 16px;
    }

    .up-cookie-revisit-badge {
        bottom: 16px;
        left: 16px;
        padding: 7px 12px;
        font-size: 0.74rem;
    }
}
