@import url('/assets/fonts/exo2.css');

/* =========================================================
   📐 BASE & VARIABLES
   ========================================================= */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Colors - Base defaults (can be overridden by client themes) */
  --c-bg: #f8f9fa;
  --c-surface: #ffffff;
  --c-sectionbg: #f8f9fa;
  --c-text: #1f2937;
  --c-muted: #6b7280;
  --c-border: #e5e7eb;
  --c-primary: #97a87a;
  --c-primary-600: #7d9063;
  --c-primary-700: #66764f;
  --c-accent: #00c2a8;
  --c-warning: #ffb020;
  --c-purple: #5c2e91;
  --c-gray-light: #e0e0e0;
  --c-gray-med: #c0c0c0;
  --c-gray-bg: #f0f0f0;
  
  /* 🎨 Theme Bridge - Client templates can override these */
  --brand: var(--c-primary);
  --brand-accent: var(--c-accent);
  --brand-light: var(--c-bg);
  --accent: var(--c-accent);
  --text-dark: var(--c-text);
  --text-light: #ffffff;
  --text-muted: var(--c-muted);
  --text-white: #ffffff;
  --input-bg: var(--c-surface);
  --input-bg-focus: var(--c-surface);
  --input-text: var(--c-text);
  --input-border: var(--c-border);
  --input-focus-shadow: 0 0 0 3px rgba(151, 168, 122, 0.2);
  
  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(17,24,39,.06);
  --shadow-sm: 0 2px 8px rgba(17,24,39,.08);
  --shadow-md: 0 8px 20px rgba(0, 62, 196, 0.1);
  --shadow-lg: 0 12px 36px rgba(17,24,39,.14);
  
  /* Z-index Scale */
  --z-base: 1;
  --z-overlay: 2;
  --z-nav: 3;
  --z-dropdown: 1000;
  --z-sticky: 1010;
  --z-fixed: 1020;
  --z-modal-backdrop: 1030;
  --z-modal: 1040;
  --z-popover: 1050;
  --z-tooltip: 1060;
  --z-max: 9999;
}

/* =========================================================
   📝 TYPOGRAPHY & BASE ELEMENTS
   ========================================================= */

html {
  /* Forza sempre la presenza dello spazio per la scrollbar per evitare shift */
  overflow-y: scroll;
  height: 100%;
}

body {
  background: var(--c-bg);
  background-image:
    radial-gradient(circle at top right, rgba(255, 162, 57, 0.08), transparent 30%),
    linear-gradient(180deg, var(--c-bg) 0%, #f5f1de 100%);
  background-repeat: no-repeat;
  color: var(--c-text);
  font-family: 'Segoe UI', sans-serif;
  overflow-x: hidden;
  /* Forza l'altezza minima a viewport + 1px per avere sempre scrollbar attiva */
  min-height: calc(100vh + 1px);
}

h1, h2, h3, h4 {
  color: var(--c-text);
  letter-spacing: .2px;
}

a {
  color: var(--brand);
  text-decoration: none;
}

.lead, .subtitle, .sottotitolo {
  color: var(--c-muted);
}

/* =========================================================
   🏗️ LAYOUT - HEADER
   ========================================================= */

header {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  box-shadow: var(--shadow-sm);
  z-index: var(--z-dropdown);
  position: relative;
}

header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1rem;
  flex-wrap: wrap;
}

header .brand-text h1 {
  font-family: 'Exo 2', sans-serif;
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--c-primary);
  margin: 0;
}

header .brand-text small {
  font-size: 0.9rem;
  color: var(--c-muted);
  display: block;
  line-height: 1.1;
}

header img {
  height: 50px;
  width: auto;
  border-radius: 6px;
  transition: opacity 0.2s ease-in-out;
}

header img:hover {
  opacity: 0.85;
}

/* =========================================================
   🏗️ LAYOUT - NAVIGATION
   ========================================================= */

.hamburger-btn {
  cursor: pointer;
  font-size: 1.5rem;
  border: none;
  background: none;
  color: var(--c-text);
  padding: 8px;
  z-index: var(--z-sticky);
  transition: color 0.2s ease;
}

.hamburger-btn:hover {
  color: var(--c-primary);
}

.menu {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  max-height: 0;
  overflow: hidden;
  transition: max-height 500ms ease;
  flex-direction: column;
  background: var(--c-gray-bg);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  z-index: var(--z-dropdown);
  padding: 0 15px;
}

.menu a {
  display: block;
  padding: 8px;
  text-decoration: none;
  color: var(--c-text);
  font-weight: 500;
  transition: background 0.2s ease;
}

.menu a.active {
  background: var(--c-gray-med);
  color: #fff;
}

.menu a:active {
  background: var(--c-gray-med);
}

.menu a:hover {
  background: var(--c-gray-light);
}

.menu.open {
  max-height: 400px;
  padding-top: 15px;
  padding-bottom: 15px;
}

header .menu a {
  color: var(--c-text);
  font-weight: 500;
  margin-left: 1.2rem;
  text-decoration: none;
  transition: color 0.2s ease;
}

header .menu a:hover {
  color: var(--c-primary);
}

/* =========================================================
   🏗️ LAYOUT - CONTENT CONTAINERS
   ========================================================= */

.content-box {
  background: #f9f9fc;
  padding: 2rem;
  max-width: 70rem;
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  /* Previene il reflow e isola il contenitore */
  contain: layout style;
  will-change: auto;
}

/* Blocca qualsiasi effetto hover su card Bootstrap che causa shift */
.card,
.card:hover {
  transform: none !important;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
  transition: none !important;
}

.content-box h2 {
  color: var(--brand);
  margin-bottom: 30px;
  font-weight: bold;
}

.content-box p {
  font-size: 1.1rem;
  margin-bottom: 15px;
}

.page-header, .subtitle, .content-box {
  max-width: 70rem;
  margin-left: auto;
  margin-right: auto;
}

/* =========================================================
   🏗️ LAYOUT - FOOTER
   ========================================================= */

footer {
  text-align: center;
  padding: 20px;
  font-size: 0.9rem;
  background-color: #fff;
  color: #999;
  margin-top: 40px;
}

.site-footer {
  background: #1a1d21;
  border-top: 3px solid var(--c-primary);
  color: #e5e7eb;
  font-size: 0.95rem;
}

.site-footer h5 {
  font-family: 'Exo 2', sans-serif;
  font-weight: 700;
  color: #fff;
}

.site-footer p {
  max-width: 750px;
  margin: 0.5rem auto;
  line-height: 1.5;
}

.footer-link:hover {
  color: var(--c-primary);
  text-decoration: underline;
}

/* =========================================================
   🎨 COMPONENTS - BUTTONS (Theme-aware)
   ========================================================= */

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--text-light);
}

.btn-primary:hover {
  background: var(--brand);
  border-color: var(--brand);
  filter: brightness(0.9);
}

.btn-outline-primary {
  color: var(--brand);
  border-color: var(--brand);
}

.btn-outline-primary:hover {
  background: var(--brand);
  color: var(--text-light);
}

.btn-soft {
  background: rgba(108,99,255,.08);
  color: var(--brand);
  border: 1px solid rgba(108,99,255,.25);
}

.btn-soft:hover {
  background: rgba(108,99,255,.14);
}

.btn-preventivo {
  font-size: 1.4rem;
  padding: 1rem 2rem;
  border-radius: 30px;
  background: linear-gradient(135deg, var(--accent, var(--brand)) 0%, var(--brand) 100%);
  border: none;
  color: var(--text-light);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.btn-preventivo:hover:enabled {
  filter: brightness(0.9);
  transform: scale(1.02);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.btn-preventivo:disabled {
  background: var(--c-gray-light);
  border-color: var(--c-gray-med);
  color: var(--c-muted);
  cursor: not-allowed;
  box-shadow: none;
}

.btn-preventivo.loading {
  position: relative;
  color: transparent;
}

.btn-preventivo.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid transparent;
  border-top-color: var(--text-light);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

button[type="submit"]:disabled {
  background-color: var(--c-gray-light);
  border-color: var(--c-gray-med);
  color: var(--c-muted);
  cursor: not-allowed;
}

#submit-hint {
  font-size: 0.85rem;
  color: #aaa;
  font-style: italic;
  margin-top: 0.25rem;
}

/* =========================================================
   🎨 COMPONENTS - FORMS
   ========================================================= */

.section {
  background: var(--c-sectionbg);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
}

.section + .section {
  margin-top: 1rem;
}

.form-control, .form-select, textarea {
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--input-text);
  box-shadow: none;
}

.form-control:focus, .form-select:focus, textarea:focus {
  border-color: var(--brand);
  background: var(--input-bg-focus);
  box-shadow: var(--input-focus-shadow);
}

input:invalid,
textarea:invalid,
input[type="checkbox"]:invalid,
select:invalid {
  border-color: #ccc;
  box-shadow: none;
  background-image: none;
}

/* Checkbox - stile standard Bootstrap */
.form-check-input[type="checkbox"] {
  width: 1em !important;
  height: 1em !important;
  min-width: 1em !important;
  min-height: 1em !important;
  max-width: 1em !important;
  max-height: 1em !important;
  margin-top: 0.25em !important;
  border: 1px solid var(--bs-border-color, #dee2e6) !important;
  border-radius: 0.25em !important;
  background-color: #fff !important;
  background-image: none !important;
  -webkit-appearance: none !important;
  appearance: none !important;
}

.form-check-input[type="checkbox"]:checked {
  background-color: var(--brand, #0d6efd) !important;
  border-color: var(--brand, #0d6efd) !important;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e") !important;
  background-size: contain !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
}

/* Reset validazione checkbox - evita X rossa */
.form-check-input:invalid,
.form-check-input.is-invalid,
.was-validated .form-check-input:invalid,
input[type="checkbox"]:invalid {
  border-color: var(--bs-border-color, #dee2e6) !important;
  background-color: #fff !important;
  background-image: none !important;
  box-shadow: none !important;
}

.form-check-input:invalid ~ .form-check-label,
.was-validated .form-check-input:invalid ~ .form-check-label {
  color: inherit !important;
}

.form-control.is-invalid,
.form-control.is-valid {
  background-image: none;
}

.form-control.is-invalid {
  border-color: #ced4da;
  box-shadow: none;
}

.form-control.is-valid {
  box-shadow: none;
}

.hint-feedback {
  display: block;
  color: var(--text-muted);
  font-style: italic;
  padding-left: 0.3rem;
  margin-top: .25rem;
}

.invalid-feedback {
  color: #a3a3a3;
}

/* Form labels and section titles - Theme-aware */
.form-label {
  color: var(--text-dark, var(--c-text));
  font-weight: 500;
}

.section h5,
.section-title {
  color: var(--brand);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

/* Titoli sezione più compatti su mobile */
@media (max-width: 768px) {
  .section h5,
  .section-title {
    font-size: 1rem;
    margin-bottom: 0.4rem;
  }
}

@media (max-width: 576px) {
  .section h5,
  .section-title {
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
  }
}

/* =========================================================
   🎨 COMPONENTS - CTA BUBBLE
   ========================================================= */

.cta-bubble {
  background: linear-gradient(135deg, #fff7e0, #ffeab6);
  border: 2px solid rgba(255, 193, 7, 0.6);
  border-radius: 24px;
  padding: 1.4rem 1.6rem;
  position: relative;
  box-shadow: 0 6px 16px rgba(0,0,0,0.1);
}

.cta-bubble h5 {
  color: #d18600;
  font-weight: 700;
  margin-bottom: .8rem;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}

.cta-bubble h5 i {
  font-size: 1.3rem;
  color: #ff9800;
}

.cta-bubble ul {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 1rem;
}

/* =========================================================
   📤 FEATURES - UPLOAD AREA (Theme-aware)
   ========================================================= */

#drop-area {
  position: relative;
  background: var(--input-bg);
  border: 2px dashed var(--input-border);
  border-radius: 12px;
  padding: .75rem;
  transition: border-color .2s ease, box-shadow .2s ease;
  box-shadow: var(--shadow-xs);
  /* Ottimizza per prevenire reflow durante hover */
  will-change: box-shadow, border-color;
  transform: translateZ(0);
}

#drop-area:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow-sm);
}

#drop-area .drop-loader {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.6);
  align-items: center;
  justify-content: center;
  z-index: var(--z-sticky);
  border-radius: .25rem;
}

#drop-area.drop-loading .drop-loader {
  display: flex;
}

.drop-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  line-height: 1.6;
  text-align: center;
  color: var(--text-light);
  background: linear-gradient(135deg, var(--brand), var(--accent, var(--brand)));
  border: 2px dashed rgba(255,255,255,.8);
  border-radius: .5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
  z-index: var(--z-sticky);
  /* Previene overflow che causa lo shift */
  contain: layout style paint;
}

#drop-area.dragover .drop-overlay {
  opacity: 1;
  /* Rimosso scale per evitare lo shift verticale della pagina */
}

#videoButton {
  border: 1px solid var(--brand);
  color: var(--brand);
  font-weight: 500;
  border-radius: 8px;
  padding: .35rem .6rem;
  background: rgba(108,99,255,.12);
  transition: all .2s ease;
}

#videoButton:hover {
  background: rgba(108,99,255,.06);
  color: var(--brand);
  box-shadow: 0 2px 6px rgba(108,99,255,.15);
}

#videoFileName {
  vertical-align: middle;
}

#audioButton {
  display: inline-block;
  border: 1px solid var(--brand);
  color: var(--brand);
  font-weight: 500;
  border-radius: 8px;
  padding: .35rem .6rem;
  background: rgba(108,99,255,.12);
  transition: all .2s ease;
  cursor: pointer;
}

#audioButton:hover {
  background: rgba(108,99,255,.06);
  color: var(--brand);
  box-shadow: 0 2px 6px rgba(108,99,255,.15);
}

#audioFileName {
  vertical-align: middle;
}

/* =========================================================
   📤 FEATURES - VALIDATION GUIDE
   ========================================================= */

#validation-guide-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
  font-size: 0.9rem;
}

#validation-guide-list li {
  display: flex;
  align-items: left;
  gap: .5rem;
  margin: .25rem 0;
}

#validation-guide-list li .ico {
  width: 1.25rem;
  text-align: center;
  font-size: .95rem;
  opacity: .75;
  color: #6c757d;
}

#validation-guide-list li.ok .ico {
  color: #198754;
  opacity: .9;
}

#validation-guide-list li .txt {
  color: #495057;
  text-align: left;
}

#validation-guide-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
}

#validation-guide-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
}

#validation-guide-progress {
  margin-left: 4px;
}

#validation-guide-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  font-size: 0.9rem;
  color: #6c757d;
}

#validation-guide-toggle .toggle-icon {
  font-size: 0.8rem;
}

#validation-guide-toggle .toggle-hint {
  white-space: nowrap;
}

/* =========================================================
   📤 FEATURES - UPLOAD PROGRESS MODAL
   ========================================================= */

#upload-progress-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(0, 0, 0, 0.95) !important;
  z-index: var(--z-max) !important;
  display: none !important;
  pointer-events: none;
}

#upload-progress-overlay.active {
  display: block !important;
  pointer-events: all;
}

.upload-progress-container {
  background: white !important;
  border-radius: 16px;
  padding: 2rem 2.5rem;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  text-align: center;
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  margin: 0 !important;
  z-index: var(--z-max) !important;
}

.upload-progress-icon {
  font-size: 3rem;
  color: var(--c-primary);
  margin-bottom: 1rem;
  animation: pulse 2s ease-in-out infinite;
}

.upload-progress-title {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--c-text);
  margin-bottom: 0.5rem;
}

.upload-progress-subtitle {
  font-size: 0.95rem;
  color: var(--c-muted);
  margin-bottom: 1.5rem;
}

.upload-progress-bar-container {
  width: 100%;
  height: 28px;
  background: #e5e7eb;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  margin-bottom: 1rem;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.upload-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--c-primary), var(--c-primary-600));
  border-radius: 14px;
  transition: width 0.3s ease;
  position: relative;
  overflow: hidden;
}

.upload-progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.2) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.2) 50%,
    rgba(255, 255, 255, 0.2) 75%,
    transparent 75%,
    transparent
  );
  background-size: 30px 30px;
  animation: progress-stripes 1s linear infinite;
}

.upload-progress-percentage {
  font-size: 2rem;
  font-weight: 700;
  color: var(--c-primary);
  margin-bottom: 0.5rem;
}

.upload-progress-details {
  font-size: 0.85rem;
  color: var(--c-muted);
  display: flex;
  justify-content: space-between;
  margin-top: 0.75rem;
  padding: 0.5rem;
  background: #f9fafb;
  border-radius: 8px;
}

.upload-progress-details span {
  display: block;
}

.upload-progress-warning {
  margin-top: 1rem;
  padding: 0.75rem;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  font-size: 0.85rem;
  color: #c2410c;
  display: none;
}

.upload-progress-warning.show {
  display: block;
}

/* =========================================================
   ⚡ UTILITIES - ANIMATIONS
   ========================================================= */

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInScale {
  from { 
    opacity: 0; 
    transform: scale(0.9);
  }
  to { 
    opacity: 1; 
    transform: scale(1);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.1); }
}

@keyframes progress-stripes {
  0% { background-position: 0 0; }
  100% { background-position: 30px 30px; }
}

/* =========================================================
   ⚡ UTILITIES - HELPER CLASSES
   ========================================================= */

.inline-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--input-border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

/* =========================================================
   📱 RESPONSIVE - TABLET (max-width: 768px)
   ========================================================= */

@media (max-width: 768px) {
  /* Riduzione padding generale per mobile */
  .section {
    padding: 0.6rem;
    border-radius: 8px;
  }
  
  .section + .section {
    margin-top: 0.5rem;
  }

  /* Form inputs più larghi e compatti */
  .form-control, .form-select, textarea {
    padding: 0.5rem 0.6rem;
    font-size: 16px; /* Previene zoom su iOS */
  }

  .form-label {
    margin-bottom: 0.2rem;
    font-size: 0.85rem;
  }

  /* Meno spazio tra gruppi form */
  .mb-3 {
    margin-bottom: 0.5rem !important;
  }

  .mb-4 {
    margin-bottom: 0.75rem !important;
  }

  /* Container minimo su mobile */
  .container {
    padding-left: 0.4rem;
    padding-right: 0.4rem;
  }

  .upload-progress-container {
    padding: 1.5rem;
    width: 90%;
    max-width: 90%;
  }

  header .container {
    flex-direction: column;
    align-items: flex-start;
    padding: 0.6rem 0.75rem;
  }

  header img {
    height: 42px;
    margin-bottom: 0.5rem;
  }

  header .brand-text h1 {
    font-size: 1.2rem;
  }

  header .brand-text small {
    font-size: 0.85rem;
  }

  .top-info-bar {
    background: linear-gradient(90deg, var(--brand), var(--accent, var(--brand)));
  }

  .site-footer {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .content-box h2, .text-warning {
    font-size: 1.6rem !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
    padding: 0 0.5rem;
  }

  #validation-guide {
    padding: 0.75rem;
  }

  #validation-guide-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  #validation-guide-summary {
    font-size: 0.9rem;
  }

  #validation-guide-toggle {
    font-size: 0.85rem;
    align-self: flex-end;
  }
}

/* =========================================================
   📱 RESPONSIVE - MOBILE (max-width: 576px)
   ========================================================= */

@media (max-width: 576px) {
  /* Padding minimo su mobile */
  .section {
    padding: 0.4rem;
    border-radius: 6px;
  }
  
  .section + .section {
    margin-top: 0.4rem;
  }

  /* Form ultra compatti */
  .form-label {
    margin-bottom: 0.15rem;
    font-size: 0.8rem;
  }

  .mb-3 {
    margin-bottom: 0.4rem !important;
  }

  .mb-4 {
    margin-bottom: 0.6rem !important;
  }

  /* Container quasi a bordo schermo */
  .container {
    padding-left: 0.25rem;
    padding-right: 0.25rem;
  }

  /* Pulsante preventivo più compatto */
  .btn-preventivo {
    font-size: 1.1rem;
    padding: 0.8rem 1.5rem;
  }

  .upload-progress-container {
    padding: 1.5rem 1.25rem;
    width: 95%;
  }

  .upload-progress-title {
    font-size: 1.2rem;
  }

  .upload-progress-percentage {
    font-size: 1.6rem;
  }

  .upload-progress-details {
    flex-direction: column;
    gap: 0.25rem;
    text-align: center;
  }

  .content-box h2, .text-warning {
    font-size: 1.3rem !important;
    line-height: 1.4;
    padding: 0 0.25rem;
  }

  #validation-guide {
    padding: 0.6rem;
    margin-bottom: 0.75rem !important;
  }

  #validation-guide-header {
    gap: 0.5rem;
  }

  #validation-guide-summary {
    font-size: 0.85rem;
    line-height: 1.4;
  }

  #validation-guide-summary > span {
    display: block;
    width: 100%;
    margin-bottom: 0.15rem;
  }

  #validation-guide-toggle {
    font-size: 0.8rem;
    width: 100%;
    justify-content: flex-end;
  }

  #validation-guide-toggle .toggle-hint {
    white-space: normal;
  }
}

/* =========================================================
   📱 RESPONSIVE - SMALL MOBILE (max-width: 400px)
   ========================================================= */

@media (max-width: 400px) {
  /* Massima compattezza per schermi piccoli */
  .section {
    padding: 0.5rem;
    border-radius: 6px;
  }
  
  .section + .section {
    margin-top: 0.5rem;
  }

  .form-label {
    font-size: 0.8rem;
    margin-bottom: 0.2rem;
  }

  .mb-3 {
    margin-bottom: 0.5rem !important;
  }

  .mb-4 {
    margin-bottom: 0.7rem !important;
  }

  .container {
    padding-left: 0.35rem;
    padding-right: 0.35rem;
  }

  .btn-preventivo {
    font-size: 1rem;
    padding: 0.7rem 1.2rem;
    border-radius: 20px;
  }

  .upload-progress-container {
    padding: 1rem;
    width: 95%;
    max-width: 95%;
    font-size: 0.9rem;
  }

  .content-box h2, .text-warning {
    font-size: 1.1rem !important;
    line-height: 1.3;
    padding: 0;
    margin-bottom: 1rem !important;
  }

  #validation-guide {
    padding: 0.5rem;
  }

  #validation-guide-summary {
    font-size: 0.8rem;
  }

  #validation-guide-summary > span {
    margin-bottom: 0.1rem;
  }
}

/* =========================================================
   💬 PP-TOOLTIP — Branded Bootstrap Tooltip Theme
   ========================================================= */

.pp-tooltip {
  z-index: 2050 !important;
}

.pp-tooltip .tooltip-inner {
  background: linear-gradient(135deg, rgba(55, 65, 81, .94), rgba(31, 41, 55, .97));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: .8rem;
  line-height: 1.45;
  max-width: 300px;
  text-align: left;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .22), 0 1px 4px rgba(0, 0, 0, .12);
  border: 1px solid rgba(255, 255, 255, .08);
}

.pp-tooltip .tooltip-arrow::before {
  border-top-color: rgba(42, 50, 62, .95);
}
.pp-tooltip[data-popper-placement^="bottom"] .tooltip-arrow::before {
  border-bottom-color: rgba(42, 50, 62, .95);
}
.pp-tooltip[data-popper-placement^="start"] .tooltip-arrow::before {
  border-left-color: rgba(42, 50, 62, .95);
}
.pp-tooltip[data-popper-placement^="end"] .tooltip-arrow::before {
  border-right-color: rgba(42, 50, 62, .95);
}

/* HTML content inside tooltips */
.pp-tooltip .tooltip-inner b,
.pp-tooltip .tooltip-inner strong { font-weight: 600; }

.pp-tooltip .tooltip-inner ul,
.pp-tooltip .tooltip-inner ol {
  margin: 4px 0 2px 0;
  padding-left: 18px;
}

.pp-tooltip .tooltip-inner li { margin-bottom: 2px; }

.pp-tooltip .tooltip-inner hr {
  border-color: rgba(255, 255, 255, .15);
  margin: 6px 0;
}

  #validation-guide-toggle {
    font-size: 0.75rem;
  }

  #validation-guide-toggle .toggle-icon {
    font-size: 0.7rem;
  }
}

/* =========================================================
   ✅ SUCCESS PAYMENT PAGE STYLES
   ========================================================= */

.success_container {
  max-width: 600px;
  text-align: center;
}

.success_checkmark {
  width: 80px;
  height: 80px;
  margin: 0 auto 30px;
  background: #28a745;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 50px;
  color: white;
}

.success_title {
  color: #28a745;
  font-size: 32px;
  margin-bottom: 30px;
  font-weight: 600;
}

.success_box {
  background: #f0f8f5;
  border-left: 5px solid #28a745;
  padding: 25px;
  border-radius: 8px;
  margin-bottom: 30px;
  text-align: left;
}

.success_box_title {
  color: #28a745;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.success_box_title::before {
  content: '✓';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: #28a745;
  color: white;
  border-radius: 50%;
  font-size: 12px;
  font-weight: bold;
}

.success_box_text {
  color: #555;
  font-size: 14px;
  line-height: 1.6;
}

.success_footer_text {
  color: #666;
  font-size: 14px;
  margin-bottom: 12px;
  line-height: 1.6;
}

.success_footer_text strong {
  color: #333;
}

/* =========================================================
   📝 FORM SINGLE LAYOUT MODE
   ========================================================= */

/* Fieldset styling per form single */
.form-single-layout fieldset.form-section {
  border: 1px solid var(--c-border, #e5e7eb);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  background: var(--c-surface, #ffffff);
  box-shadow: var(--shadow-xs, 0 1px 2px rgba(17,24,39,.06));
  transition: box-shadow 0.2s ease;
}

.form-single-layout fieldset.form-section:hover {
  box-shadow: var(--shadow-sm, 0 2px 8px rgba(17,24,39,.08));
}

.form-single-layout fieldset.form-section legend {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--c-primary, #6c63ff);
  padding: 0 0.75rem;
  margin-bottom: 0.4rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.form-single-layout fieldset.form-section legend i {
  font-size: 1.1rem;
}

/* Nasconde pulsanti navigazione wizard in modalità single */
.form-single-layout .btn-step-1-continue,
.form-single-layout .btn-step-2-continue,
.form-single-layout .btn-step-2-back,
.form-single-layout .btn-step-3-back {
  display: none !important;
}

/* In modalità single, tutti gli step sono visibili */
.form-single-layout #step-1,
.form-single-layout #step-2,
.form-single-layout #step-3 {
  display: block !important;
}

/* Responsive: riduci padding fieldset su mobile */
@media (max-width: 768px) {
  .form-single-layout fieldset.form-section {
    padding: 0.75rem;
    margin-bottom: 1.25rem;
  }
  
  .form-single-layout fieldset.form-section legend {
    font-size: 1.1rem;
  }
}

/* Modalità wizard: mantieni comportamento originale */
.form-wizard-layout .btn-step-1-continue,
.form-wizard-layout .btn-step-2-continue,
.form-wizard-layout .btn-step-2-back,
.form-wizard-layout .btn-step-3-back {
  display: inline-block;
}

/* Rimuovi bordi/ombre dai div.section interni in modalità single */
.form-single-layout .section {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  padding: 0 !important;
}

/* Indentazione contenuto rispetto alla legend - minima */
.form-single-layout fieldset.form-section > .section,
.form-single-layout fieldset.form-section > div:not(.text-center) {
  padding-left: 0.5rem !important;
  padding-right: 0.5rem !important;
}

/* Spacing ottimizzato per form single */
.form-single-layout .section {
  margin-bottom: 0;
}

.form-single-layout .cta-bubble {
  margin-top: 1.5rem !important;
}

/* =========================================================
   Support Help Button
   ========================================================= */
.support-help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--c-muted, #6b7280);
  font-size: 1rem;
  text-decoration: none;
  transition: color .15s, background .15s;
  cursor: pointer;
  flex-shrink: 0;
}
.support-help-btn:hover {
  color: var(--c-primary, #448670);
  background: rgba(68, 134, 112, .08);
}
