/* ============================================================
   cookie-banner.css v2.0 — 3 livelli di consenso
   ============================================================ */

/* ── BANNER PRINCIPALE ──────────────────────────────────────── */
#cookie-banner {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 9999;
    background: rgba(10, 20, 32, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(245,158,11,0.25);
    box-shadow: 0 -8px 48px rgba(0,0,0,0.55);
    transform: translateY(110%);
    transition: transform 0.45s cubic-bezier(0.22,1,0.36,1);
}

#cookie-banner.cookie-visible { transform: translateY(0); }

.cookie-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.375rem clamp(1.25rem,5vw,2.5rem);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2rem;
    align-items: center;
}

.cookie-title {
    font-family: 'Syne', sans-serif;
    font-size: 0.9375rem;
    font-weight: 700;
    color: #F1F5F9;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.375rem;
}

.cookie-desc {
    font-size: 0.8rem;
    color: #94A3B8;
    line-height: 1.65;
    max-width: 720px;
    margin: 0;
}

.cookie-desc a { color: #F59E0B; text-decoration: underline; text-underline-offset: 2px; }
.cookie-desc a:hover { color: #FCD34D; }

.cookie-actions {
    display: flex;
    gap: 0.625rem;
    align-items: center;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* ── BOTTONI ────────────────────────────────────────────────── */
.cookie-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.125rem;
    border-radius: 8px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    white-space: nowrap;
    transition: all 0.2s ease;
    line-height: 1;
}

.cookie-btn--accept {
    background: #F59E0B;
    color: #0D1B2A;
    font-weight: 700;
    box-shadow: 0 2px 12px rgba(245,158,11,0.3);
}
.cookie-btn--accept:hover {
    background: #FCD34D;
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(245,158,11,0.45);
}

.cookie-btn--necessary {
    background: transparent;
    color: #F1F5F9;
    border: 1px solid rgba(255,255,255,0.4);
    font-weight: 600;
}
.cookie-btn--necessary:hover {
    color: #fff;
    border-color: rgba(255,255,255,0.7);
    background: rgba(255,255,255,0.05);
}

.cookie-btn--settings {
    background: transparent;
    color: #64748B;
    font-size: 0.8125rem;
    text-decoration: underline;
    text-underline-offset: 2px;
    padding: 0.6rem 0.75rem;
}
.cookie-btn--settings:hover { color: #94A3B8; }

.cookie-btn--save {
    background: rgba(245,158,11,0.1);
    color: #F59E0B;
    border: 1px solid rgba(245,158,11,0.3);
    font-weight: 600;
}
.cookie-btn--save:hover { background: rgba(245,158,11,0.2); }

/* ── PANNELLO AVANZATO ──────────────────────────────────────── */
#cookie-settings-panel {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
#cookie-settings-panel.panel-open {
    opacity: 1;
    pointer-events: all;
}

.cookie-panel-card {
    background: #162232;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 18px;
    width: 100%;
    max-width: 560px;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 32px 80px rgba(0,0,0,0.7);
    transform: translateY(16px) scale(0.97);
    transition: transform 0.35s cubic-bezier(0.22,1,0.36,1);
}
#cookie-settings-panel.panel-open .cookie-panel-card {
    transform: translateY(0) scale(1);
}

/* scrollbar pannello */
.cookie-panel-card::-webkit-scrollbar { width: 4px; }
.cookie-panel-card::-webkit-scrollbar-track { background: transparent; }
.cookie-panel-card::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.cookie-panel-header {
    padding: 1.5rem 1.75rem 1.125rem;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: #162232;
    z-index: 2;
}

.cookie-panel-header h3 {
    font-family: 'Syne', sans-serif;
    font-size: 1.125rem;
    font-weight: 700;
    color: #F1F5F9;
    margin: 0;
}

.cookie-panel-close {
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 6px;
    background: rgba(255,255,255,0.06);
    color: #94A3B8;
    cursor: pointer;
    border: none;
    font-size: 1rem;
    transition: all 0.15s;
}
.cookie-panel-close:hover { background: rgba(255,255,255,0.12); color: #F1F5F9; }

.cookie-panel-intro {
    padding: 1rem 1.75rem 0;
    font-size: 0.8125rem;
    color: #64748B;
    line-height: 1.65;
}

.cookie-panel-body {
    padding: 1rem 1.75rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* ── CATEGORIA COOKIE ───────────────────────────────────────── */
.cookie-category {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.2s;
}
.cookie-category:has(.cookie-toggle input:checked) {
    border-color: rgba(245,158,11,0.2);
}

.cookie-category-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.125rem 1.25rem 0.875rem;
}

.cookie-category-info {}
.cookie-category-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #F1F5F9;
    display: block;
    margin-bottom: 0.25rem;
}
.cookie-category-vendor {
    font-size: 0.75rem;
    color: #64748B;
}

.cookie-category-detail {
    padding: 0 1.25rem 1.125rem;
    border-top: 1px solid rgba(255,255,255,0.05);
    font-size: 0.8125rem;
    color: #64748B;
    line-height: 1.65;
}

.cookie-detail-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.75rem;
    font-size: 0.75rem;
}
.cookie-detail-table th {
    text-align: left;
    color: #94A3B8;
    font-weight: 500;
    padding: 0.25rem 0.5rem 0.25rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.cookie-detail-table td {
    color: #64748B;
    padding: 0.3rem 0.5rem 0.3rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    vertical-align: top;
}
.cookie-detail-table td:first-child { color: #94A3B8; font-family: monospace; font-size: 0.7rem; }

/* ── TOGGLE ─────────────────────────────────────────────────── */
.cookie-toggle { position: relative; flex-shrink: 0; }
.cookie-toggle input {
    position: absolute; opacity: 0; width: 0; height: 0;
}
.cookie-toggle-track {
    display: block;
    width: 44px; height: 24px;
    background: rgba(255,255,255,0.12);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.25s;
    position: relative;
}
.cookie-toggle input:checked + .cookie-toggle-track { background: #F59E0B; }
.cookie-toggle input:disabled + .cookie-toggle-track { opacity: 0.45; cursor: not-allowed; }
.cookie-toggle-track::after {
    content: '';
    position: absolute;
    top: 3px; left: 3px;
    width: 18px; height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.25s cubic-bezier(0.22,1,0.36,1);
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.cookie-toggle input:checked + .cookie-toggle-track::after { transform: translateX(20px); }

.cookie-always-on {
    font-size: 0.75rem;
    color: #10B981;
    font-weight: 600;
    white-space: nowrap;
    padding: 0.25rem 0;
    margin-top: 0.125rem;
}

/* ── FOOTER PANNELLO ────────────────────────────────────────── */
.cookie-panel-footer {
    padding: 1.125rem 1.75rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.07);
    display: flex;
    gap: 0.625rem;
    justify-content: flex-end;
    flex-wrap: wrap;
    position: sticky;
    bottom: 0;
    background: #162232;
    z-index: 2;
}

.cookie-panel-links {
    padding: 0.75rem 1.75rem;
    font-size: 0.75rem;
    color: #475569;
    text-align: center;
    line-height: 1.8;
}
.cookie-panel-links a { color: #64748B; text-decoration: underline; text-underline-offset: 2px; }
.cookie-panel-links a:hover { color: #94A3B8; }

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    .cookie-inner { grid-template-columns: 1fr; gap: 1rem; }
    .cookie-actions { width: 100%; }
    .cookie-btn--accept, .cookie-btn--necessary { flex: 1; }
}
@media (max-width: 480px) {
    .cookie-panel-card { max-height: 92vh; border-radius: 14px 14px 0 0; margin-bottom: 0; }
    #cookie-settings-panel { align-items: flex-end; padding: 0; }
    .cookie-actions { flex-direction: column; }
    .cookie-btn { width: 100%; }
}
