/* =========================================================
   Latto B2B – Frontend CSS
   ========================================================= */

/* =========================================================
   Pagina Modifica Indirizzo Fatturazione (My Account)
   Campi B2B custom: Ragione Sociale, P.IVA, Codice Fiscale
   ========================================================= */

/* Etichette dei campi B2B evidenziate */
#billing_partita_iva_field label,
#billing_codice_fiscale_field label,
#billing_company_field label {
    font-weight: 600;
}

/* Affianca P.IVA e CF su schermi larghi */
#billing_partita_iva_field,
#billing_codice_fiscale_field {
    width: 48%;
    float: left;
}
#billing_partita_iva_field {
    margin-right: 4%;
}

/* Pulizia float dopo la coppia P.IVA / CF */
#billing_codice_fiscale_field::after {
    content: '';
    display: table;
    clear: both;
}

/* Fallback responsive: campo intero su mobile */
@media (max-width: 600px) {
    #billing_partita_iva_field,
    #billing_codice_fiscale_field {
        width: 100%;
        float: none;
        margin-right: 0;
    }
}

/* Nota informativa sotto i campi */
#billing_partita_iva_field .woocommerce-input-wrapper::after {
    content: 'Es. 12345678901 (11 cifre)';
    display: block;
    font-size: 11px;
    color: #888;
    margin-top: 3px;
}

/* Highlight campo con errore P.IVA */
#billing_partita_iva_field.woocommerce-invalid input,
#billing_codice_fiscale_field.woocommerce-invalid input {
    border-color: #dc3545;
}
#billing_partita_iva_field.woocommerce-validated input {
    border-color: #198754;
}

/* =========================================================
   Prezzo nascosto
   ========================================================= */
.b2b-price-hidden {
    display: inline-block;
    font-size: 14px;
    color: #1a237e;
}
.b2b-price-hidden a {
    color: #1a237e;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px dotted #1a237e;
}
.b2b-price-hidden a:hover {
    border-bottom-style: solid;
}

/* =========================================================
   Avviso login su singolo prodotto
   ========================================================= */
.b2b-login-notice {
    background: #e8edf8;
    border-left: 4px solid #1a237e;
    padding: 14px 18px;
    border-radius: 0 6px 6px 0;
    margin: 16px 0;
}
.b2b-login-notice p {
    margin: 0;
    font-size: 15px;
    color: #333;
}
.b2b-login-notice a {
    color: #1a237e;
    font-weight: 600;
}

/* =========================================================
   Pagina Login/Registrazione unificata
   ========================================================= */
.latto-b2b-login-page {
    max-width: 640px;
    margin: 32px auto;
}

/* Tab navigation */
.latto-b2b-tabs {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 28px;
}
.latto-b2b-tabs .tab-btn {
    background: none;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: color .2s, border-color .2s;
}
.latto-b2b-tabs .tab-btn:hover {
    color: #1a237e;
}
.latto-b2b-tabs .tab-btn.active {
    color: #1a237e;
    border-bottom-color: #1a237e;
}

/* Tab content */
.latto-b2b-tab-content {
    display: none;
}
.latto-b2b-tab-content.active {
    display: block;
}

/* =========================================================
   Form Registrazione Azienda
   ========================================================= */
.latto-b2b-registration-form {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 28px 32px;
}

.latto-b2b-registration-form h2 {
    margin: 0 0 20px;
    font-size: 20px;
    color: #1a237e;
}

/* Errori */
.latto-b2b-errors {
    background: #fee2e2;
    border: 1px solid #f87171;
    border-radius: 6px;
    padding: 14px 18px;
    margin-bottom: 20px;
}
.latto-b2b-errors ul {
    margin: 0;
    padding-left: 18px;
}
.latto-b2b-errors ul li {
    color: #991b1b;
    font-size: 14px;
    margin-bottom: 4px;
}

/* Grid campi */
.b2b-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 600px) {
    .b2b-form-grid { grid-template-columns: 1fr; }
    .latto-b2b-registration-form { padding: 20px 16px; }
}

.b2b-form-field {
    display: flex;
    flex-direction: column;
}
.b2b-form-field.full-width {
    grid-column: 1 / -1;
}

.b2b-form-field label {
    font-size: 13px;
    font-weight: 600;
    color: #444;
    margin-bottom: 5px;
}
.b2b-form-field label .required {
    color: #dc3545;
    margin-left: 2px;
}

.b2b-form-field input,
.b2b-form-field select,
.b2b-form-field textarea {
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 9px 12px;
    font-size: 14px;
    transition: border-color .2s, box-shadow .2s;
    width: 100%;
    box-sizing: border-box;
}
.b2b-form-field input:focus,
.b2b-form-field select:focus,
.b2b-form-field textarea:focus {
    outline: none;
    border-color: #1a237e;
    box-shadow: 0 0 0 3px rgba(26,35,126,.12);
}
.b2b-form-field input.error,
.b2b-form-field select.error {
    border-color: #dc3545;
}

/* Hint validazione P.IVA */
.b2b-piva-hint {
    font-size: 11px;
    color: #666;
    margin-top: 3px;
}
.b2b-piva-hint.valid { color: #166534; }
.b2b-piva-hint.invalid { color: #991b1b; }

/* Separatore sezione */
.b2b-form-section {
    grid-column: 1 / -1;
    font-size: 13px;
    font-weight: 700;
    color: #1a237e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e8edf8;
    padding-bottom: 6px;
    margin-top: 8px;
}

/* Privacy checkbox */
.b2b-privacy-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    grid-column: 1 / -1;
    margin-top: 8px;
}
.b2b-privacy-row input[type="checkbox"] {
    width: auto;
    margin-top: 3px;
    flex-shrink: 0;
}
.b2b-privacy-row label {
    font-size: 13px;
    color: #555;
    font-weight: normal;
}

/* Bottone submit */
.b2b-submit-btn {
    grid-column: 1 / -1;
    background: #1a237e;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 13px 28px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: background .2s;
    margin-top: 8px;
}
.b2b-submit-btn:hover {
    background: #283593;
}
.b2b-submit-btn:disabled {
    background: #9fa8da;
    cursor: not-allowed;
}

/* =========================================================
   Pagina "In attesa di approvazione"
   ========================================================= */
.latto-b2b-awaiting {
    max-width: 580px;
    margin: 40px auto;
    background: #fff;
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,.08);
}
.latto-b2b-awaiting .awaiting-icon {
    font-size: 64px;
    margin-bottom: 20px;
    display: block;
}
.latto-b2b-awaiting h2 {
    color: #1a237e;
    font-size: 26px;
    margin: 0 0 16px;
}
.latto-b2b-awaiting p {
    color: #555;
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 14px;
}
.latto-b2b-awaiting .awaiting-email-highlight {
    font-weight: 700;
    color: #1a237e;
}
.latto-b2b-awaiting .contact-box {
    background: #f0f4ff;
    border: 1px solid #c7d4f0;
    border-radius: 8px;
    padding: 14px 20px;
    margin-top: 20px;
    font-size: 14px;
    color: #444;
}
