/* =========================================================================
   YoCash — Cookie consent banner
   GDPR + Provvedimento Garante 10/06/2021. Pulsanti di pari peso visivo
   (no dark pattern). Colori allineati ai design token YoCash.
   ========================================================================= */

.yc-cc {
    --yc-cc-bg:        #ffffff;
    --yc-cc-fg:        #0d1c2f;
    --yc-cc-muted:     #44474c;
    --yc-cc-border:    #c4c6cc;
    --yc-cc-primary:   #101b30;
    --yc-cc-accent:    #47607e;
    --yc-cc-on-accent: #ffffff;
    --yc-cc-radius:    0.75rem;

    position: fixed;
    z-index: 2147483000; /* sopra ogni overlay applicativo */
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    max-width: 560px;
    margin: 0 auto;
    background: var(--yc-cc-bg);
    color: var(--yc-cc-fg);
    border: 1px solid rgba(196, 198, 204, 0.6);
    border-radius: var(--yc-cc-radius);
    box-shadow: 0 20px 48px rgba(13, 28, 47, 0.22);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 0.875rem;
    line-height: 1.5;
    overflow: hidden;
    animation: yc-cc-in 0.35s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.yc-cc[hidden] { display: none; }

@keyframes yc-cc-in {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.yc-cc-body { padding: 1.25rem 1.25rem 1rem; }

.yc-cc-title {
    font-family: 'Manrope', 'Inter', sans-serif;
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: -0.3px;
    margin: 0 0 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.yc-cc-title .material-symbols-outlined { font-size: 1.25rem; color: var(--yc-cc-accent); }

.yc-cc-text { color: var(--yc-cc-muted); margin: 0 0 0.5rem; }

.yc-cc-links { margin: 0 0 0.25rem; font-size: 0.8rem; }

.yc-cc-links a {
    color: var(--yc-cc-accent);
    text-decoration: underline;
    font-weight: 600;
}

.yc-cc-links a:hover { color: var(--yc-cc-primary); }

/* ---- Pulsanti --------------------------------------------------------- */
.yc-cc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.yc-cc-btn {
    flex: 1 1 auto;
    min-width: 120px;
    padding: 0.6rem 1rem;
    border-radius: 0.5rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid var(--yc-cc-primary);
    background: #fff;
    color: var(--yc-cc-primary);
    transition: background 0.2s, color 0.2s, opacity 0.2s, transform 0.1s;
    text-align: center;
}

.yc-cc-btn:hover { background: #f1f3f7; }
.yc-cc-btn:active { transform: translateY(1px); }

.yc-cc-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.yc-cc-btn:disabled:hover { background: #fff; }
.yc-cc-btn--primary:disabled:hover { background: var(--yc-cc-primary); }

/* Stato di caricamento: testo nascosto + spinner centrale */
.yc-cc-btn.is-loading {
    color: transparent !important;
    opacity: 1;
    pointer-events: none;
    position: relative;
}
.yc-cc-btn.is-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(16, 27, 48, 0.3);
    border-top-color: var(--yc-cc-primary);
    border-radius: 50%;
    animation: yc-cc-spin 0.6s linear infinite;
}
.yc-cc-btn--primary.is-loading::after {
    border-color: rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
}

@keyframes yc-cc-spin { to { transform: rotate(360deg); } }

/* "Accetta tutti" e "Salva" pieni — stesso peso visivo dei secondari (bordo
   identico), solo riempimento per gerarchia minima ammessa dal Garante. */
.yc-cc-btn--primary {
    background: var(--yc-cc-primary);
    color: #fff;
}
.yc-cc-btn--primary:hover { background: #1a2c4d; }

/* ---- Pannello preferenze --------------------------------------------- */
.yc-cc-prefs {
    margin-top: 1rem;
    border-top: 1px solid rgba(196, 198, 204, 0.5);
    padding-top: 0.75rem;
}

.yc-cc-prefs[hidden] { display: none; }

.yc-cc-cat {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid rgba(196, 198, 204, 0.35);
}
.yc-cc-cat:last-child { border-bottom: none; }

.yc-cc-cat-info { flex: 1; }
.yc-cc-cat-name { font-weight: 700; font-size: 0.85rem; }
.yc-cc-cat-desc { color: var(--yc-cc-muted); font-size: 0.78rem; margin-top: 0.15rem; }

/* Switch */
.yc-cc-switch {
    position: relative;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
}
.yc-cc-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.yc-cc-slider {
    position: absolute;
    inset: 0;
    background: #c4c6cc;
    border-radius: 999px;
    transition: background 0.2s;
}
.yc-cc-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}
.yc-cc-switch input:checked + .yc-cc-slider { background: var(--yc-cc-accent); }
.yc-cc-switch input:checked + .yc-cc-slider::before { transform: translateX(18px); }
.yc-cc-switch input:disabled + .yc-cc-slider { background: var(--yc-cc-accent); opacity: 0.55; cursor: not-allowed; }
.yc-cc-switch input:disabled { cursor: not-allowed; }

@media (max-width: 480px) {
    .yc-cc { left: 0.5rem; right: 0.5rem; bottom: 0.5rem; }
    .yc-cc-btn { flex: 1 1 100%; }
}
