/* Banner cookie custom Tempario — stile standalone (indipendente da Tailwind) */
.tcb-root,
.tcb-root * {
    box-sizing: border-box;
}

.tcb-root {
    --tcb-primary: #0056a7;
    --tcb-primary-hover: #00468a;
    --tcb-text: #1f2937;
    --tcb-muted: #6b7280;
    --tcb-border: #e5e7eb;
    --tcb-bg: #ffffff;
    font-family: inherit;
    color: var(--tcb-text);
    line-height: 1.5;
}

.tcb-root[hidden] {
    display: none !important;
}

/* ---- Primo livello (informativa breve) ---- */
.tcb-notice {
    position: fixed;
    z-index: 99999;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    max-width: 460px;
    background: var(--tcb-bg);
    border: 1px solid var(--tcb-border);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    padding: 1.25rem;
    animation: tcb-slide-up 0.25s ease-out;
}

.tcb-notice[hidden] {
    display: none !important;
}

@keyframes tcb-slide-up {
    from { transform: translateY(12px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

.tcb-title {
    margin: 0 0 0.5rem;
    font-size: 1.125rem;
    font-weight: 700;
}

.tcb-text {
    margin: 0;
    font-size: 0.875rem;
    color: var(--tcb-text);
}

.tcb-link {
    color: var(--tcb-primary);
    text-decoration: underline;
}

.tcb-link:hover {
    color: var(--tcb-primary-hover);
}

.tcb-notice__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* ---- Bottoni (Accetta e Rifiuta con pari evidenza) ---- */
.tcb-btn {
    flex: 1 1 auto;
    min-width: 120px;
    padding: 0.6rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 9px;
    border: 1px solid var(--tcb-primary);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.tcb-btn--primary {
    background: var(--tcb-primary);
    color: #fff;
}

.tcb-btn--primary:hover {
    background: var(--tcb-primary-hover);
    border-color: var(--tcb-primary-hover);
}

.tcb-btn--ghost {
    background: transparent;
    color: var(--tcb-primary);
}

.tcb-btn--ghost:hover {
    background: rgba(0, 86, 167, 0.08);
}

.tcb-btn:focus-visible {
    outline: 2px solid var(--tcb-primary);
    outline-offset: 2px;
}

/* ---- Secondo livello (pannello preferenze, modale) ---- */
.tcb-prefs {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(17, 24, 39, 0.55);
    animation: tcb-fade 0.2s ease-out;
}

.tcb-prefs[hidden] {
    display: none !important;
}

@keyframes tcb-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.tcb-prefs__panel {
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    background: var(--tcb-bg);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.tcb-prefs__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--tcb-border);
}

.tcb-close {
    background: none;
    border: none;
    font-size: 1.75rem;
    line-height: 1;
    color: var(--tcb-muted);
    cursor: pointer;
    padding: 0 0.25rem;
}

.tcb-close:hover {
    color: var(--tcb-text);
}

.tcb-prefs__body {
    padding: 1.25rem 1.5rem;
}

.tcb-cat {
    border: 1px solid var(--tcb-border);
    border-radius: 11px;
    padding: 1rem;
    margin-top: 1rem;
}

.tcb-cat__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.tcb-cat__name {
    font-weight: 600;
}

.tcb-cat__desc {
    margin: 0.5rem 0 0;
    font-size: 0.8125rem;
    color: var(--tcb-muted);
}

/* ---- Toggle switch ---- */
.tcb-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
}

.tcb-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.tcb-switch__slider {
    position: relative;
    width: 42px;
    height: 24px;
    background: #cbd5e1;
    border-radius: 999px;
    transition: background-color 0.15s ease;
    flex-shrink: 0;
}

.tcb-switch__slider::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.15s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.tcb-switch input:checked + .tcb-switch__slider {
    background: var(--tcb-primary);
}

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

.tcb-switch input:focus-visible + .tcb-switch__slider {
    outline: 2px solid var(--tcb-primary);
    outline-offset: 2px;
}

.tcb-switch__label {
    font-size: 0.8125rem;
    color: var(--tcb-muted);
}

.tcb-switch--locked {
    cursor: not-allowed;
}

.tcb-switch--locked .tcb-switch__slider {
    opacity: 0.7;
}

.tcb-prefs__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--tcb-border);
}

/* ---- Responsive ---- */
@media (max-width: 520px) {
    .tcb-notice {
        left: 0.5rem;
        right: 0.5rem;
        bottom: 0.5rem;
        max-width: none;
    }

    .tcb-btn {
        flex-basis: 100%;
    }
}
