/* ── Form Validation Modal ─────────────────────────────── */
.form-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(1, 2, 46, 0.6);
    z-index: 99998;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.form-modal-overlay.is-visible {
    display: flex;
}
.form-modal {
    background: #fff;
    border-radius: 12px;
    padding: 36px 40px;
    max-width: 460px;
    width: 100%;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
    text-align: center;
}
.form-modal__icon {
    width: 52px;
    height: 52px;
    background: rgba(0, 71, 255, 0.08);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}
.form-modal__icon svg {
    width: 26px;
    height: 26px;
    stroke: var(--tg-theme-primary, #0047FF);
}
.form-modal h4 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--tg-theme-secondary, #01022E);
    margin-bottom: 10px;
}
.form-modal p {
    font-size: 0.9rem;
    color: var(--tg-body-color, #343C4D);
    margin-bottom: 16px;
}
.form-modal-errors {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
    text-align: left;
    display: inline-block;
    width: 100%;
}
.form-modal-errors li {
    font-size: 0.88rem;
    color: var(--tg-theme-secondary, #01022E);
    padding: 6px 0 6px 22px;
    position: relative;
    border-bottom: 1px solid rgba(0, 71, 255, 0.08);
}
.form-modal-errors li:last-child {
    border-bottom: none;
}
.form-modal-errors li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tg-theme-primary, #0047FF);
}
.form-modal .form-modal__close {
    background: var(--tg-theme-primary, #0047FF);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 10px 32px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.form-modal .form-modal__close:hover {
    background: var(--tg-theme-secondary, #01022E);
}

/* ── Submit Button Spinner ──────────────────────────────── */
@keyframes tg-spin {
    to { transform: rotate(360deg); }
}
.btn-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: tg-spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
    flex-shrink: 0;
}

/* ── Response Modal icon variants ───────────────────────── */
.form-modal__icon--success {
    background: rgba(40, 167, 69, 0.1);
}
.form-modal__icon--success svg {
    stroke: #28a745;
}
.form-modal__icon--error {
    background: rgba(220, 0, 0, 0.1);
}
.form-modal__icon--error svg {
    stroke: #DC0000;
}

/* ── Cookie Banner ─────────────────────────────────────── */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    background: var(--tg-theme-primary, #0047FF);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.25);
    border-top: none;
    padding: 18px 0;
}

.cookie-banner__text {
    margin: 0;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
    font-family: var(--tg-body-font-family, "Poppins", sans-serif);
}

.cookie-banner__text strong {
    color: #fff;
    font-size: 15px;
    display: block;
    margin-bottom: 4px;
}

.cookie-banner__text a {
    color: #fff;
    text-decoration: underline;
    opacity: 0.85;
}

.cookie-banner__text a:hover {
    opacity: 1;
}

.cookie-banner__buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: nowrap;
    align-items: center;
}

.cookie-btn {
    padding: 10px 22px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--tg-body-font-family, "Poppins", sans-serif);
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.cookie-btn--accept {
    background: #fff;
    color: var(--tg-theme-primary, #0047FF);
    border: 2px solid #fff;
}

.cookie-btn--accept:hover {
    background: var(--tg-theme-secondary, #01022E);
    border-color: var(--tg-theme-secondary, #01022E);
    color: #fff;
}

.cookie-btn--reject {
    background: transparent;
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.6);
}

.cookie-btn--reject:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #fff;
    color: #fff;
}

.cookie-btn--pref {
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    border: 2px solid transparent;
    text-decoration: underline;
    padding-left: 8px;
    padding-right: 8px;
}

.cookie-btn--pref:hover {
    color: #fff;
    text-decoration: none;
}

/* bottone salva nel pannello preferenze */
.cookie-btn--save {
    background: var(--tg-theme-primary, #0047FF);
    color: #fff;
    border: 2px solid var(--tg-theme-primary, #0047FF);
}

.cookie-btn--save:hover {
    background: var(--tg-theme-secondary, #01022E);
    border-color: var(--tg-theme-secondary, #01022E);
}

@media (max-width: 991px) {
    .cookie-banner__buttons {
        justify-content: flex-start;
        margin-top: 14px;
    }
}

/* ── Cookie Preferences Panel ───────────────────────────── */
.cookie-pref-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(1, 2, 46, 0.65);
    z-index: 100000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.cookie-pref-overlay.is-visible {
    display: flex;
}

.cookie-pref-modal {
    background: #fff;
    border-radius: 14px;
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.cookie-pref-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 28px 18px;
    border-bottom: 1px solid #eef0f4;
}

.cookie-pref-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--tg-theme-secondary, #01022E);
    margin: 0;
}

.cookie-pref-close {
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: #aaa;
    padding: 0 4px;
    transition: color 0.2s;
}

.cookie-pref-close:hover {
    color: var(--tg-theme-secondary, #01022E);
}

.cookie-pref-body {
    padding: 20px 28px;
    overflow-y: auto;
    flex: 1;
}

.cookie-pref-body > p {
    font-size: 0.88rem;
    color: var(--tg-body-color, #343C4D);
    margin-bottom: 20px;
}

.cookie-pref-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid #eef0f4;
}

.cookie-pref-row:last-child {
    border-bottom: none;
}

.cookie-pref-info {
    flex: 1;
}

.cookie-pref-info strong {
    display: block;
    font-size: 0.9rem;
    color: var(--tg-theme-secondary, #01022E);
    margin-bottom: 4px;
}

.cookie-pref-info p {
    font-size: 0.82rem;
    color: #666;
    margin: 0;
    line-height: 1.5;
}

.cookie-pref-toggle {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding-top: 2px;
}

/* Badge "Sempre attivo" */
.cookie-sempre-attivo {
    font-size: 0.78rem;
    font-weight: 600;
    color: #28a745;
    background: rgba(40, 167, 69, 0.1);
    border-radius: 20px;
    padding: 3px 10px;
    white-space: nowrap;
}

/* Toggle switch */
.cookie-toggle {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
    cursor: pointer;
    flex-shrink: 0;
}

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

.cookie-toggle-slider {
    position: absolute;
    inset: 0;
    background: #ccc;
    border-radius: 26px;
    transition: background 0.25s;
}

.cookie-toggle-slider::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.25s;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.cookie-toggle input:checked + .cookie-toggle-slider {
    background: var(--tg-theme-primary, #0047FF);
}

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

/* Footer del pannello */
.cookie-pref-footer {
    display: flex;
    gap: 10px;
    padding: 18px 28px;
    border-top: 1px solid #eef0f4;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.cookie-pref-footer .cookie-btn--reject,
.cookie-pref-footer .cookie-btn--accept {
    background: transparent;
    color: var(--tg-theme-primary, #0047FF);
    border-color: var(--tg-theme-primary, #0047FF);
}

.cookie-pref-footer .cookie-btn--reject:hover,
.cookie-pref-footer .cookie-btn--accept:hover {
    background: var(--tg-theme-primary, #0047FF);
    color: #fff;
}

@media (max-width: 480px) {
    .cookie-pref-footer {
        flex-direction: column-reverse;
    }
    .cookie-pref-footer .cookie-btn {
        width: 100%;
        text-align: center;
    }
}

/* ── Cookie Policy page ─────────────────────────────────── */
.cookie-policy__section {
    border-left: 4px solid var(--tg-theme-primary, #0047FF);
    padding-left: 20px;
    margin-bottom: 36px;
}

.cookie-policy__section h3 {
    color: var(--tg-heading-color, #01022E);
    font-size: 20px;
    margin-bottom: 10px;
}

.cookie-policy__section p {
    color: var(--tg-body-color, #343C4D);
    font-size: 15px;
    line-height: 1.75;
    margin: 0;
}

.cookie-manage-btn {
    display: inline-block;
    margin-top: 16px;
    padding: 12px 28px;
    background: var(--tg-theme-primary, #0047FF);
    color: #fff;
    border: 2px solid var(--tg-theme-primary, #0047FF);
    border-radius: 4px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    font-family: var(--tg-body-font-family, "Poppins", sans-serif);
    transition: background 0.2s, color 0.2s;
}

.cookie-manage-btn:hover {
    background: var(--tg-theme-secondary, #01022E);
    border-color: var(--tg-theme-secondary, #01022E);
    color: #fff;
}
