/* --- SETTINGS SPECIFIC --- */

.settings-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
    margin-top: -10px; /* Allineamento con l'header come referral */
}

/* Card principale (come .ref-card) */
.settings-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
}

/* Titoli delle sezioni */
.settings-container h1 {
    margin-bottom: -5px;
}


.settings-container h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-main);
}

/* Gruppo Input (per email e codici) */
.settings-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.settings-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.settings-input-row input[type="email"],
.settings-input-row input[type="text"] {
    flex: 1;
    min-width: 250px;
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 12px 15px;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
}

/* Switch personalizzati */
.email-pref-row {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.switch-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
}

.switch-label {
    font-size: 14px;
    color: var(--text-main);
}

.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 22px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #242b36;
    transition: .4s;
    border-radius: 34px;
    border: 1px solid var(--border-color);
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px; width: 14px;
    left: 4px; bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider { background-color: var(--accent-green); border-color: var(--accent-green); }
input:checked + .slider:before { transform: translateX(24px); }
input:disabled + .slider { opacity: 0.5; cursor: not-allowed; }

/* Messaggi di feedback (stabile come referral) */
.msg-container {
    height: 25px;
    display: flex;
    align-items: center;
    padding-left: 5px;
}

.feedback-msg {
    visibility: hidden;
    color: var(--accent-green);
    font-size: 0.85em;
    font-weight: 600;
}

.feedback-msg.show-msg { visibility: visible; }

/* Mobile */
@media(max-width: 900px) {
    .settings-input-row { flex-direction: column; align-items: stretch; }
    .settings-input-row input { width: 100%; min-width: auto; }
    .btn-ref-action { width: 100%; }
}

/* FORM BOT - coerente con calculator/contact */

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

/* INPUT FULL WIDTH + DARK */
.form-group input,
.form-group select {
    width: 100%;
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 8px;
    padding: 12px 15px;
    font-size: 14px;
    outline: none;
}

/* SELECT CUSTOM (freccia custom + remove default) */
.form-group select {
    appearance: none;
    cursor: pointer;

    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 16px;

    padding-right: 40px; /* spazio per la freccia */
}

/* CHECKBOX ALLINEATA */
.form-checkbox {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

/* Rimuove il verde forte se vuoi stile clean (opzionale) */
/*
input:focus, select:focus {
    border-color: var(--border-color);
    box-shadow: none;
}
*/

/* --- FORCE DARK INPUTS (BOT FORM) --- */

.settings-card input[type="text"],
.settings-card input[type="number"],
.settings-card select {
    width: 100%;
    background-color: var(--bg-dark) !important;
    color: var(--text-main) !important;
    border-radius: 8px;
    padding: 12px 15px;
    font-size: 14px;
    outline: none !important;
}
/* --- BOT FORM CLEAN (usa stile globale dashboard) --- */

.settings-card input[type="text"],
.settings-card input[type="number"],
.settings-card select {
    width: 100%;
    background-color: var(--bg-dark); /* nero */
    color: var(--text-main);
    border-radius: 8px;
    padding: 12px 15px;
    font-size: 14px;

    /* IMPORTANTE: NON tocchiamo border e focus */
}

/* SELECT CUSTOM (solo estetica, non tocca border) */
.settings-card select {
    appearance: none;
    cursor: pointer;
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 16px;

    padding-right: 40px;
}

/* autofill fix (senza rompere border) */
.settings-card input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px var(--bg-dark) inset;
    -webkit-text-fill-color: var(--text-main);
}

/* checkbox normale */
.settings-card input[type="checkbox"] {
    width: auto;
}

.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-main);
    cursor: pointer;
}

.checkbox-inline input[type="checkbox"] {
    width: auto;
    accent-color: var(--accent-green);
}

.form-hint {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-top: 6px;
    margin-bottom: 15px;
}


/* RENEW SECTION - FIXED */

/* 1. Global Reset for the Renew Section to prevent horizontal scroll */
.settings-container section,
.settings-card,
.plan-selector,
.coupon-row {
    box-sizing: border-box;
    max-width: 100%;
}

/* 2. Plan Selector Fix (Best Value Badge & Cropping) */
.plan-selector {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 12px;
    margin: 30px 0 20px 0; /* Increased top margin to give space to the badge */
    width: 100%;
}

.plan-option {
    flex: 1;
    min-width: 0; 
    cursor: pointer;
}

.plan-option input[type="radio"] {
    display: none;
}

.plan-content {
    position: relative; /* Context for the badge */
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 25px 10px;
    border-radius: 12px;
    text-align: center;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: all 0.2s ease;
}

.plan-option input[type="radio"]:checked + .plan-content {
    background-color: #f1f5f9;
    border-color: #ffffff;
}

.plan-option input[type="radio"]:checked + .plan-content span {
    color: #0f172a !important;
}

/* Fix: The badge was cropped because the parent had overflow:hidden or insufficient margin */
.plan-badge {
    position: absolute;
    top: -12px; /* Pulls it above the card border */
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--accent-green);
    color: #ffffff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

/* 3. Coupon Row (Inline text and fixed width input) */
.coupon-row {
    display: flex;
    align-items: center; /* Vertical alignment */
    gap: 15px;
    margin: 30px 0;
}

.coupon-row .premium-label {
    margin-bottom: 0; /* Remove default margin to stay aligned with input */
    white-space: nowrap;
}

.coupon-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

#coupon {
    /* "7 chars text" width calculation: ~10px per char + padding */
    width: 200px; 
    min-width: 100px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    color: white;
    outline: none;
}

#couponMsg {
    font-size: 13px;
    font-weight: 500;
}

/* 4. Country & Footer */
.country-full-width {
    max-width: 400px; /* Limits width so it's not huge on desktop */
    margin-bottom: 30px;
}

.checkout-footer {
    padding-top: 25px;
    border-top: 1px solid var(--border-color);
}

.final-price {
    font-size: 18px;
    color: var(--text-muted);
    margin-bottom: 15px;
}

.final-price span {
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
    margin-left: 5px;
}

/* Responsive Fixes */
@media (max-width: 768px) {
    .plan-selector {
        flex-direction: column;
        margin-top: 15px;
    }
    
    .plan-badge {
        top: 50%;
        left: auto;
        right: -10px;
        transform: translateY(-50%);
    }

    .coupon-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* --- STILI SCHEDA RIEPILOGO --- */
.summary-card {
    background: #171a21;
    border: 1px solid #2b3139;
    border-radius: 12px;
    padding: 30px;
    margin-top: 40px;
    /* Impostazione predefinita (Mobile First) */
    width: 100%; 
    box-sizing: border-box; /* Assicura che il padding non sballi la larghezza */
}

/* Desktop: scatta quando lo schermo è più largo di 768px (o 1024px a tua scelta) */
@media (min-width: 768px) {
    .summary-card {
        width: 60%;
        margin-left: auto;  /* Opzionale: centra la card */
        margin-right: auto; /* Opzionale: centra la card */
    }
}

.summary-card h3 {
    color: #fff;
    font-size: 1.4rem;
    margin-top: 0;
    margin-bottom: 24px;
    border-bottom: 1px solid #2b3139;
    padding-bottom: 16px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    color: #a0a5ab; /* Grigio chiaro per le label */
    font-size: 1rem;
    border-bottom: 1px dashed #2b3139; /* Separatore leggero e moderno */
}

/* Rimuove il bordo tratteggiato dall'ultima riga prima del totale */
.summary-row:last-of-type {
    border-bottom: none;
}

.summary-row strong {
    color: #fff;
    font-weight: 500;
}

/* Riga del Totale */
.summary-row.total-row {
    margin-top: 16px;
    border-top: 1px solid #2b3139;
    padding-top: 24px;
    font-size: 1.2rem;
    border-bottom: none;
}

.summary-row.total-row strong {
    font-size: 1.6rem;
    color: #02c39a; /* Usa un verde acceso (o il tuo colore primario) per il prezzo finale */
}

/* --- SEZIONE COUPON (Integrata e invisibile) --- */
.coupon-section {
    background: transparent;
    padding: 0;
    border: none;
    margin: 24px 0;
}

.coupon-section label {
    display: block;
    margin-bottom: 10px;
    font-size: 0.95rem;
    color: #a0a5ab;
}

.coupon-input-group {
    display: flex;
}

.coupon-input-group input {
    width: 100%;
    padding: 12px 16px;
    background: transparent; /* Niente sfondi pieni */
    border: 1px solid #2b3139;
    color: #fff;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.coupon-input-group input:focus {
    outline: none;
    border-color: #02c39a;
}

#couponMsg {
    display: block;
    margin-top: 8px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* --- BOTTONE PAGAMENTO --- */
.submit-btn {
    width: 100%;
    padding: 16px;
    background-color: #fff;
    color: #000;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    margin-top: 24px;
}

.submit-btn:hover {
    background-color: #e6e6e6;
}

.secure-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;           /* Spazio tra icona e testo */
    margin-top: 15px;   /* Distanza dal pulsante */
    font-size: 0.85rem; /* Testo leggermente più piccolo */
}

.secure-notice .material-symbols-outlined {
    font-size: 18px;    /* Dimensione icona */
    vertical-align: middle;
}

.text-muted {
    color: #6c757d;     /* Il classico grigio sobrio per i testi secondari */
}

/* Media query per dispositivi mobili (schermi sotto i 768px) */
@media (max-width: 768px) {
    .duration-container, 
    .plans-container {
        display: flex;
        flex-direction: column; /* Forza la disposizione verticale */
        gap: 15px;             /* Aggiunge spazio tra una card e l'altra */
    }

    .duration-card, 
    .plan-card {
        width: 100% !important; /* Forza la card a prendere tutta la larghezza */
        margin-left: 0;
        margin-right: 0;
        box-sizing: border-box;  /* Evita che il padding sfori la larghezza */
    }
}

/* MOBILE FIX */
@media (max-width: 480px) {
    .funding-toggle {
        align-items: flex-start; /* allinea meglio se va su 2 righe */
    }

    .funding-toggle label {
        white-space: normal;   /* 🔥 permette il wrap */
        word-break: break-word;
    }
}