/* ============================================================
   1. VARIABILI E RESET RADICE
   ============================================================ */
:root {
  --brand: #BF2322;
  /* Nuovo Rosso Rugby Milano */
  --brand-dark: #1a2b3c;
  /* Blu Notte */
  --bg-light: #f4f7f6;
  /* Grigio Sfondo */
  --border-grey: #dee2e6;
  --text-muted: #7f8c8d;
  --rm-red: #BF2322;
  --rm-dark: #212529;
  --rm-success: #2d8a4e;
}

html,
body {
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  height: 100% !important;
  overflow-x: hidden;
  background-color: var(--bg-light);
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* Spazio per la navbar fissa */
body {
  padding-top: 75px !important;
}

/* ============================================================
   2. NAVBAR (HEADER)
   ============================================================ */
.navbar {
  position: fixed !important;
  top: 0 !important;
  left: 0;
  right: 0;
  width: 100% !important;
  height: 65px !important;
  /* Abbassiamo la navbar a 1000 (standard Bootstrap) */
  z-index: 1030 !important;
  background-color: #BF2322 !important;
}

/* Il backdrop (lo sfondo scuro del modale) deve stare sopra la navbar */
.modal-backdrop {
  z-index: 1040 !important;
}

/* Il modale deve stare sopra lo sfondo scuro */
.modal {
  z-index: 1050 !important;
}

/* Se hai usato l'ID specifico per lo shop */
#modalConfiguratore {
  z-index: 1060 !important;
}

#modalConfiguratore .modal-header {
  padding-top: 20px !important;
  padding-bottom: 10px !important;
}

.header-logo {
  height: 42px;
  width: auto;
  filter: drop-shadow(0px 2px 4px rgba(0, 0, 0, 0.2));
}

.navbar-brand img {
  mix-blend-mode: multiply;
  /* Fonde il bianco del logo con il rosso */
}

/* ============================================================
   3. SCHERMATA LOGIN & AUTH (COMPATTA)
   ============================================================ */
.auth-card {
  background: white;
  padding: 20px 25px;
  border-radius: 16px;
  width: 100%;
  max-width: 360px;
  border-top: 6px solid var(--brand);
}

.logo-compact {
  height: 55px;
  width: auto;
}

.tab-btn {
  padding: 6px;
  font-size: 0.85rem;
}

.form-label-compact {
  font-size: 0.75rem;
  font-weight: 700;
  color: #666;
  text-transform: uppercase;
}

.btn-brand-compact,
.btn-staff-solid-compact {
  background-color: var(--brand);
  color: white !important;
  border: none;
  font-weight: bold;
  border-radius: 8px;
  transition: 0.3s;
}

/* ============================================================
   4. SELETTORE FAMIGLIA (BOLLE)
   ============================================================ */
.family-nav {
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 20px;
  padding: 15px 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.family-nav::-webkit-scrollbar {
  display: none;
}

.family-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
  cursor: pointer;
  opacity: 0.6;
  transition: 0.3s;
}

.family-item.active {
  opacity: 1;
  transform: scale(1.1);
}

.avatar-circle {
  width: 55px;
  height: 55px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eee;
  border: 2px solid var(--border-grey);
  font-size: 1.2rem;
  color: #999;
}

.family-item.active .avatar-circle {
  border-color: var(--brand);
  border-width: 3px;
  background: white;
  color: var(--brand);
}

/* Stato validazione bolle */
.family-item.is-valid-member .avatar-circle {
  border-color: #28a745 !important;
}

.family-item.is-invalid-member .avatar-circle {
  border-color: #dc3545 !important;
}

/* ============================================================
   5. COMPONENTI FORM (INPUT, LABELS, TITOLI)
   ============================================================ */
.main-card {
  background: white;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  padding: 30px;
  position: relative;
  border: none;
  margin-bottom: 25px;
}

.rm-section-title {
  background-color: #f8f9fa;
  padding: 8px 15px;
  margin: 20px 0 10px 0;
  border-left: 5px solid var(--brand);
  font-weight: 800;
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--brand-dark);
  letter-spacing: 1px;
}

.label-xs {
  font-size: 0.65rem;
  font-weight: 800;
  color: #bbb;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.val-field {
  font-size: 0.85rem !important;
}

.val-field:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 0.25rem rgba(191, 35, 34, 0.1);
  /* Colore aggiornato in RGBA */
}

.val-field.is-invalid {
  background-color: #fff8f8 !important;
  border: 1px solid #dc3545 !important;
}

/* --- HELP TEXT (Sottotitoli compatti) --- */
.help-text {
  display: block;
  clear: both;
  font-size: 0.65rem !important;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.1 !important;
  /* Testo incollato */
  margin-top: 2px !important;
  margin-bottom: 8px !important;
}

/* ============================================================
   6. FIX DEFINITIVO SWITCH (ANTI-CERCHIO GIGANTE)
   ============================================================ */
.form-switch .form-check-input {
  width: 2.2em !important;
  height: 1.2em !important;
  margin-top: 0.25em !important;
  margin-bottom: 5px !important;
  border-radius: 2em !important;
  background-color: #fff;
  border: 1px solid #ced4da;
  cursor: pointer;
  /* Pallino grigio default */
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba%280, 0, 0, 0.25%29'/%3e%3c/svg%3e") !important;
}

.form-switch .form-check-input:checked {
  background-color: var(--brand) !important;
  border-color: var(--brand) !important;
  /* Pallino bianco quando acceso */
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e") !important;
}

.form-switch .form-check-input.is-invalid {
  background-color: #fff !important;
  border-color: #dc3545 !important;
  /* Pallino rosso quando obbligatorio e vuoto */
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23dc3545'/%3e%3c/svg%3e") !important;
}

/* ============================================================
   7. SHOP (CATALOGO E CARRELLO)
   ============================================================ */
#shop-view {
  margin-top: 5px !important;
  font-size: 0.8rem;
}

.shop-category-container {
  display: flex;
  flex-wrap: wrap;
  gap: 12px !important;
  padding: 0 10px;
}

.category-tile {
  width: 90px !important;
  text-align: center;
}

.tile-img-box {
  width: 90px !important;
  height: 90px !important;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #ddd;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tile-name {
  font-size: 0.65rem !important;
  font-weight: 700;
  text-transform: uppercase;
}

.product-row-card {
  padding: 12px 18px !important;
  border-radius: 14px !important;
  border: 1px solid #e2e8f0 !important;
  margin-bottom: 8px !important;
}

.product-row-card:hover {
  border-color: var(--brand) !important;
  transform: translateY(-2px);
}

/* --- DIVISORE CATALOGO CENTRATO --- */
.shop-divider {
  height: 1px;
  background-color: #dee2e6;
  margin: 40px 0 25px 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.shop-divider::after {
  content: "CATALOGO PAGAMENTI";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: -10px;
  background: var(--bg-light);
  padding: 0 20px;
  color: #adb5bd;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
}

/* ============================================================
   8. UTILITY, OVERLAYS E RESPONSIVE
   ============================================================ */
#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(244, 247, 246, 0.95);
  z-index: 9999 !important;
  display: none;
  /* <--- Aggiungi questo per farlo nascere spento */
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

#service-view {
  position: fixed;
  top: 65px;
  left: 0;
  width: 100%;
  height: calc(100vh - 65px);
  z-index: 2000;
  background: white;
}

@media (max-width: 768px) {
  .family-nav {
    justify-content: flex-start;
    padding-left: 10px;
  }

  .atleta-nome {
    font-size: 1.4rem;
    padding-right: 0;
    margin-top: 40px;
  }

  .shop-category-container {
    justify-content: center;
  }
}

.tech-pill {
  background-color: #f1f3f5;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 5px 12px;
  min-width: 90px;
  display: flex;
  flex-direction: column;
}

.label-xxs {
  font-size: 0.55rem;
  font-weight: 800;
  color: #888;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.val-tech {
  font-weight: 700;
  font-size: 0.85rem;
  color: #333;
}

.badge-stato {
  height: 38px;
  /* Allineato all'altezza delle tech-pill */
  display: flex;
  align-items: center;
  border-radius: 12px;
  padding: 0 15px;
}

/* --- STILE PER MULTI-LISTA (CHECKLIST) --- */
.multi-list-container {
  background-color: #fff;
  border: 1px solid var(--border-grey);
  border-radius: 8px;
  padding: 8px;
  max-height: 140px;
  overflow-y: auto;
  width: 100%;
}

.multi-list-item {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
}

.multi-list-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-right: 10px;
  cursor: pointer;
}

.multi-list-item label {
  font-size: 0.75rem;
  cursor: pointer;
  margin-bottom: 0;
}

.multi-list-item input {
  width: 15px;
  height: 15px;
  margin-right: 10px;
  cursor: pointer;
}

/* Evidenzia il bordo se il campo è obbligatorio e vuoto */
.multi-list-container.is-invalid {
  border: 2px solid #dc3545 !important;
  background-color: #fff8f8;
}

/* Anteprima Documenti Rettangolare (Proporzione Tessera) */
.img-doc-preview {
  width: 90px !important;
  /* Larghezza aumentata */
  height: 55px !important;
  /* Altezza proporzionata */
  border-radius: 6px;
  object-fit: contain;
  /* Fondamentale: non taglia i bordi del documento */
  background-color: #f8f9fa;
  /* Sfondo grigio chiaro per le parti vuote */
  border: 1px solid #dee2e6;
  cursor: pointer;
  transition: all 0.2s ease;
}

.img-doc-preview:hover {
  border-color: var(--brand) !important;
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Bordo rosso se obbligatorio e mancante */
.img-doc-preview.img-invalid {
  border: 2px solid #dc3545 !important;
  background-color: #fff8f8 !important;
}

/* --- PAGAMENTI LOOK AND FEEL (COPIA IMMAGINE) --- */

.cart-header-top {
  font-size: 0.75rem;
  /* Più sobrio */
  padding: 8px 15px;
}

.cart-table-header {
  background-color: #ffffff;
  font-size: 0.65rem;
  font-weight: 800;
  color: #444;
  text-transform: uppercase;
  border-bottom: 2px solid #eee;
  padding: 8px 20px;
}

.cart-row {
  background-color: white;
  border-bottom: 1px solid #eee;
  padding: 15px 20px;
  transition: background 0.2s;
}

.cart-row:hover {
  background-color: #fcfcfc;
}

.beneficiary-name {
  font-weight: 700;
  font-size: 0.85rem;
  /* Ridotto */
  color: var(--rm-dark);
}

.beneficiary-sub {
  font-size: 0.65rem;
  /* Ridotto */
}

.beneficiary-sub b {
  color: var(--rm-red);
  text-transform: capitalize;
}

.price-big {
  font-weight: 800;
  font-size: 0.95rem;
  /* Ridotto */
}

.price-listino {
  font-size: 0.75rem;
}

/* Pulsanti Arrotondati */
.btn-conferma {
  background-color: var(--rm-success);
  color: white;
  border-radius: 50px;
  padding: 10px 25px;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.85rem;
  border: none;
}

.btn-conferma:hover {
  background-color: #246d3e;
  color: white;
}

/* Pulsante ACQUISTA Rosso Solido */

.btn-acquista {
  background-color: #BF2322 !important;
  /* Nuovo Rosso RM */
  color: white !important;
  border: none !important;
  border-radius: 8px !important;
  padding: 8px 18px !important;
  font-weight: 700 !important;
  font-size: 0.75rem !important;
  text-transform: uppercase;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-acquista:hover {
  background-color: #991C1B !important;
  /* Versione leggermente più scura del nuovo rosso per hover */
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-acquista:active {
  transform: translateY(0);
}

/* Catalog Card */
.catalog-card {
  background: white;
  border-radius: 15px;
  border: 1px solid #e0e0e0;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.catalog-card .title {
  font-weight: 700;
  font-size: 0.9rem;
  /* Ridotto da 1.1 */
}

.catalog-card .subtitle {
  font-size: 0.7rem;
  /* Ridotto */
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-sconto {
  background-color: #e8f5e9;
  color: var(--rm-success);
  font-size: 0.6rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Stile per la descrizione nel catalogo */
.catalog-desc {
  font-size: 0.72rem;
  color: #6c757d;
  line-height: 1.2;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  /* Limita a 2 righe per non sfasare le card */
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- STILE CARRELLO RIEPILOGO (LOOK IMMAGINE) --- */
.cart-card {
  background: white;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e0e0e0;
}

.cart-header {
  background-color: #212529;
  color: white;
  padding: 10px 20px;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-header .badge {
  background-color: #dc3545;
  font-size: 0.7rem;
  padding: 4px 10px;
}

.cart-table-head {
  font-size: 0.65rem;
  font-weight: 800;
  color: #444;
  text-transform: uppercase;
  padding: 8px 20px;
  border-bottom: 1px solid #eee;
}

.cart-item-row {
  padding: 12px 20px;
  border-bottom: 1px solid #eee;
  font-size: 0.85rem;
}

.cart-item-row .beneficiary-name {
  font-weight: 700;
  color: #000;
}

.cart-item-row .beneficiary-for {
  font-size: 0.7rem;
  color: #666;
}

.cart-item-row .beneficiary-for b {
  color: #BF2322;
  /* Nuovo Rosso Rugby Milano */
  text-transform: uppercase;
}

.cart-item-row .price-val {
  color: #888;
  font-size: 0.8rem;
}

.cart-item-row .total-val {
  font-weight: 800;
  font-size: 1rem;
  color: #000;
}

.btn-remove-item {
  color: #dc3545;
  background: none;
  border: none;
  font-size: 1.1rem;
  padding: 0;
  line-height: 1;
}

/* Footer Carrello */
.cart-footer {
  padding: 20px;
  background-color: #fff;
}

.total-label {
  font-size: 0.65rem;
  font-weight: 800;
  color: #666;
  text-transform: uppercase;
}

.total-amount {
  font-size: 1.8rem;
  font-weight: 800;
  color: #BF2322;
  /* Nuovo Rosso RM */
  line-height: 1;
}

.btn-conferma-procedi {
  background-color: #2d8a4e !important;
  color: white !important;
  border-radius: 50px !important;
  padding: 10px 30px !important;
  font-weight: 700 !important;
  font-size: 0.85rem !important;
  text-transform: uppercase;
  border: none !important;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Pulsante Bonifico */
.btn-bonifico {
  background-color: #1a2b3c !important;
  /* Blu scuro professionale */
  color: white !important;
  border-radius: 50px !important;
  padding: 8px 20px !important;
  font-weight: 700 !important;
  font-size: 0.75rem !important;
  text-transform: uppercase;
  border: none !important;
  transition: all 0.2s;
  width: 100%;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-bonifico:hover {
  background-color: #0d161f !important;
  transform: translateY(-1px);
}

.btn-bonifico i {
  margin-right: 8px;
}

/* Quando il body ha la classe 'is-production' nascondiamo gli elementi */
body.is-production .tab-container,
body.is-production #login-form,
body.is-production #register-form,
body.is-production .auth-link-sm,
body.is-production #btn-main-iscrizioni {
  display: none !important;
}

/* Opzionale: rendi il pulsante Google più centrale e "unico" in produzione */
body.is-production .staff-section {
  background: transparent;
  padding: 0;
}

body.is-production .staff-section p {
  color: #495057 !important;
  /* Grigio scuro invece di rosso */
  font-size: 0.8rem;
}