/* =============================================
   A.P.A. — Ritorno alle Origini — Public Style
   ============================================= */

:root {
  --bg:           #0a0a0a;
  --bg-card:      #111111;
  --bg-input:     #1a1a1a;
  --accent:       #E84B1A;
  --accent-dark:  #bf3d15;
  --accent-light: #f07a58;
  --accent-border:#3d1a10;
  --text:         #ffffff;
  --text-muted:   #cc8070;
  --error:        #ef4444;
  --error-bg:     #450a0a;
  --success:      #22c55e;
  --success-bg:   #052e16;
  --border:       #2a2a2a;
  --radius:       8px;
  --radius-lg:    12px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Barlow', sans-serif;
  font-weight: 400;
  line-height: 1.6;
  min-height: 100vh;
}

/* ---- Language Switcher ---- */
.lang-switcher {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100;
  display: flex;
  gap: 6px;
}
.lang-btn {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Barlow', sans-serif;
  letter-spacing: 1px;
  text-decoration: none;
  border: 1px solid var(--accent-border);
  color: var(--text-muted);
  background: var(--bg-card);
  transition: all 0.2s;
}
.lang-btn:hover, .lang-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---- Hero ---- */
.hero {
  text-align: center;
  padding: 80px 20px 40px;
  background: linear-gradient(180deg, #1a0800 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--accent-border);
}
.hero-inner { max-width: 600px; margin: 0 auto; }
.hero-title {
  font-family: 'Bebas Neue', cursive;
  font-size: clamp(56px, 12vw, 96px);
  letter-spacing: 8px;
  color: var(--text);
  line-height: 1;
  text-shadow: 0 0 40px rgba(232,75,26,0.5);
}
.hero-subtitle {
  font-family: 'Bebas Neue', cursive;
  font-size: clamp(14px, 3vw, 20px);
  letter-spacing: 6px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ---- Main Container ---- */
.main-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

/* ---- Form Card ---- */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-lg);
  padding: 40px;
}
@media (max-width: 600px) {
  .form-card { padding: 24px 16px; }
}

.form-title {
  font-family: 'Bebas Neue', cursive;
  font-size: 28px;
  letter-spacing: 3px;
  color: var(--text);
  margin-bottom: 28px;
  text-align: center;
}

/* ---- Alerts ---- */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.5;
}
.alert-error   { background: var(--error-bg);   border: 1px solid var(--error);   color: #fca5a5; }
.alert-success { background: var(--success-bg); border: 1px solid var(--success); color: #86efac; }

/* ---- Tabs ---- */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 32px;
  border-bottom: 2px solid var(--accent-border);
  padding-bottom: 0;
}
.tab-btn {
  flex: 1;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: 'Bebas Neue', cursive;
  font-size: 18px;
  letter-spacing: 2px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  border-radius: var(--radius) var(--radius) 0 0;
}
.tab-btn:hover { color: var(--text); background: rgba(232,75,26,0.08); }
.tab-btn.active {
  color: #fff;
  border-bottom-color: var(--accent);
  background: rgba(232,75,26,0.12);
}

/* ---- Nota durata partecipazione ---- */
.durata-nota {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 4px;
  padding: 10px 14px;
  font-family: 'Barlow', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--text, #1f2937);
  background: rgba(232,75,26,0.08);
  border-left: 3px solid var(--accent, #e84b1a);
  border-radius: 6px;
}
.durata-nota .durata-icon { font-size: 16px; line-height: 1; }

/* ---- Form Grid ---- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
}
.form-group--full { grid-column: 1 / -1; }

/* ---- Form Elements ---- */
.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
  font-family: 'Bebas Neue', cursive;
  font-size: 14px;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.req { color: var(--error); font-size: 16px; line-height: 1; }
.hint { font-family: 'Barlow', sans-serif; font-size: 11px; letter-spacing: 0; color: #6b7280; font-weight: 400; }

.form-input,
.form-select,
.form-textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: 'Barlow', sans-serif;
  font-size: 15px;
  padding: 11px 14px;
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232,75,26,0.2);
}
.form-input.error,
.form-select.error {
  border-color: var(--error);
}
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23E84B1A' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}
.form-select option { background: var(--bg-card); color: var(--text); }
.form-textarea { resize: vertical; min-height: 100px; }

/* ---- Input with @ prefix ---- */
.input-prefix-wrap { position: relative; }
.input-prefix {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 15px;
  pointer-events: none;
}
.form-input.with-prefix { padding-left: 26px; }

/* ---- Phone Selector ---- */
.phone-wrap { display: flex; gap: 8px; align-items: flex-start; }
.phone-prefix-container { position: relative; flex-shrink: 0; }
.phone-prefix-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 11px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  font-family: 'Barlow', sans-serif;
  font-size: 15px;
  min-width: 90px;
  transition: border-color 0.2s;
}
.phone-prefix-btn:hover { border-color: var(--accent); }
.phone-prefix-btn .arrow { font-size: 10px; color: var(--text-muted); }
.phone-number-input { flex: 1; }

.phone-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 200;
  background: var(--bg-card);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  width: 280px;
  max-height: 260px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.phone-dropdown[hidden] { display: none !important; }
.phone-search-wrap { padding: 8px; border-bottom: 1px solid var(--border); }
.phone-search {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  outline: none;
}
.phone-search:focus { border-color: var(--accent); }
.phone-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  padding: 4px 0;
}
.phone-option {
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: background 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.phone-option:hover, .phone-option.selected { background: rgba(232,75,26,0.2); }

/* ---- Upload Area ---- */
.upload-area {
  position: relative;
  background: var(--bg-input);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  overflow: hidden;
}
.upload-area:hover, .upload-area.drag-over {
  border-color: var(--accent);
  background: rgba(232,75,26,0.05);
}
.upload-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  z-index: 2;
}
.upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px;
  pointer-events: none;
  text-align: center;
}
.upload-icon { font-size: 28px; }
.upload-text { font-size: 13px; color: var(--text-muted); }
.upload-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  width: 100%;
}
.upload-preview img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.upload-preview .file-icon { font-size: 32px; }
.upload-preview span { font-size: 13px; color: var(--text-muted); word-break: break-all; }

/* ---- Privacy & Submit ---- */
.form-footer {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.privacy-group { flex-direction: row; align-items: flex-start; }
.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}
.checkbox-label input[type="checkbox"] { display: none; }
.checkbox-custom {
  width: 20px;
  height: 20px;
  min-width: 20px;
  border: 2px solid var(--accent-border);
  border-radius: 4px;
  background: var(--bg-input);
  position: relative;
  transition: all 0.2s;
  margin-top: 2px;
}
.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
  background: var(--accent);
  border-color: var(--accent);
}
.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 13px;
  line-height: 1;
}
.checkbox-text { font-size: 14px; color: var(--text-muted); line-height: 1.5; }
.privacy-link { color: var(--accent-light); text-decoration: none; }
.privacy-link:hover { text-decoration: underline; }

.submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 32px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: 'Bebas Neue', cursive;
  font-size: 20px;
  letter-spacing: 2px;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s, transform 0.1s;
}
.submit-btn:hover { background: var(--accent-dark); }
.submit-btn:active { transform: scale(0.99); }
.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ---- Spinner ---- */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
.spinner[hidden] { display: none !important; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Success Page ---- */
.success-card {
  text-align: center;
  background: var(--bg-card);
  border: 1px solid #22c55e;
  border-radius: var(--radius-lg);
  padding: 60px 40px;
}
.success-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #052e16;
  border: 2px solid #22c55e;
  color: #22c55e;
  font-size: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
}
.success-title {
  font-family: 'Bebas Neue', cursive;
  font-size: 36px;
  letter-spacing: 3px;
  margin-bottom: 16px;
  color: var(--text);
}
.success-message {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 500px;
  margin: 0 auto 32px;
  line-height: 1.7;
}
.btn-back {
  display: inline-block;
  padding: 12px 28px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  text-decoration: none;
  font-family: 'Bebas Neue', cursive;
  font-size: 16px;
  letter-spacing: 2px;
  transition: background 0.2s;
}
.btn-back:hover { background: var(--accent-dark); }

/* ---- Footer ---- */
.site-footer {
  text-align: center;
  padding: 24px;
  font-size: 13px;
  color: #4b5563;
  border-top: 1px solid var(--accent-border);
}

/* ---- AIPP section ---- */
.aipp-section, .form-section {
  padding: 16px 0;
  border-top: 1px solid var(--accent-border);
  margin-top: 4px;
}
.aipp-upload-group { margin-top: 8px; }
.checkbox-label--big { font-size: 15px; gap: 10px; }
.checkbox-label--big .checkbox-text { line-height: 1.4; }

/* ---- Price summary ---- */
.price-summary {
  background: #1a1a2e;
  border: 1px solid var(--accent-border);
  border-radius: 12px;
  padding: 20px 24px;
  margin: 24px 0 8px;
}
.price-summary__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.price-summary__rows { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.price-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: #d1d5db;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.price-row--discount { color: #4ade80; }
.price-summary__total {
  display: flex;
  justify-content: space-between;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  padding-top: 10px;
  border-top: 1px solid var(--accent-border);
  margin-top: 6px;
}
.price-summary__nota {
  font-size: 11px;
  color: #6b7280;
  margin-top: 10px;
}
.price-summary__eb {
  font-size: 12px;
  color: #4ade80;
  margin-top: 4px;
}

/* ---- Success price box ---- */
.success-price-box {
  background: rgba(var(--accent-rgb, 232,75,26), 0.08);
  border: 1px solid var(--accent-border);
  border-radius: 8px;
  padding: 16px 20px;
  margin: 20px auto;
  max-width: 320px;
  text-align: center;
}
.success-price-label { display: block; font-size: 12px; color: #9ca3af; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 1px; }
.success-price-amount { display: block; font-size: 28px; font-weight: 700; color: var(--accent); }
.success-price-nota { font-size: 12px; color: #6b7280; margin-top: 6px; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--accent-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }
