/* checkout-style.css - Stile dedicato per il Checkout e Ordine Hardware/Software Rivo */

.checkout-main {
  padding: 120px 0 80px;
  min-height: calc(100vh - 120px);
}

.checkout-header-trust {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.trust-badge-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.checkout-page-header {
  text-align: center;
  max-width: 760px;
  margin: 0 auto 48px;
}

.checkout-title {
  font-size: 2.4rem;
  font-weight: 800;
  margin: 12px 0 8px;
}

.checkout-subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
}

/* Layout 2 Colonne */
.checkout-layout {
  display: grid;
  grid-template-columns: 1.6fr 1.1fr;
  gap: 36px;
  align-items: flex-start;
}

/* Card Step */
.checkout-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-card);
}

.checkout-card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.step-badge {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  flex-shrink: 0;
  box-shadow: 0 0 15px var(--primary-glow);
}

.checkout-card-header h3 {
  font-size: 1.25rem;
  margin-bottom: 2px;
}

.checkout-card-header p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin: 0;
}

/* Step 1: Piano & Sedi */
.plan-selection-box {
  border: 2px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.08) 0%, rgba(15, 23, 42, 0.4) 100%);
  margin-bottom: 16px;
}

[data-theme="light"] .plan-selection-box {
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.06) 0%, #ffffff 100%);
}

.plan-selection-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.plan-tag {
  display: inline-block;
  background: var(--primary);
  color: #ffffff;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.plan-info h4 {
  font-size: 1.2rem;
  margin-bottom: 6px;
}

.plan-info p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.45;
}

.plan-price {
  text-align: right;
  flex-shrink: 0;
}

.plan-price .price-val {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-white);
}

.plan-price .price-unit {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.plan-price .price-ann {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Box Sede Aggiuntiva */
.addon-option-box {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.02);
  transition: var(--transition-smooth);
}

.addon-option-box:hover {
  border-color: rgba(59, 130, 246, 0.4);
}

.addon-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  cursor: pointer;
  user-select: none;
}

.addon-checkbox-label input {
  display: none;
}

.custom-checkbox {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-light);
  border-radius: 6px;
  display: inline-block;
  position: relative;
  flex-shrink: 0;
  margin-top: 2px;
  transition: var(--transition-smooth);
  background: rgba(15, 23, 42, 0.6);
}

[data-theme="light"] .custom-checkbox {
  background: #ffffff;
  border-color: #cbd5e1;
}

.addon-checkbox-label input:checked + .custom-checkbox {
  background: var(--primary);
  border-color: var(--primary);
}

.addon-checkbox-label input:checked + .custom-checkbox::after {
  content: "✓";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.addon-text {
  flex-grow: 1;
}

.addon-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  gap: 12px;
  flex-wrap: wrap;
}

.addon-title-row strong {
  font-size: 0.95rem;
  color: var(--text-white);
}

.addon-price-badge {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
}

.addon-text p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0;
}

/* Step 2: Accessori Grid */
.accessories-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.accessory-card {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 18px 16px;
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition-smooth);
}

.accessory-card:hover {
  border-color: rgba(59, 130, 246, 0.4);
}

.accessory-card.selected {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.08);
  box-shadow: 0 4px 18px rgba(59, 130, 246, 0.15);
}

.accessory-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.acc-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
}

.acc-badge-one-off {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  border: 1px solid var(--border-light);
  padding: 2px 6px;
  border-radius: 4px;
}

.accessory-card h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.35;
}

.accessory-card p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 16px;
  flex-grow: 1;
}

.acc-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.acc-price {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-white);
}

.acc-price small {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
}

.btn-acc-toggle {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-light);
  color: var(--text-white);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.accessory-card.selected .btn-acc-toggle {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

/* Step 3: Form Dati */
.checkout-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group.span-2 {
  grid-column: span 2;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 14px 18px;
  background: rgba(30, 41, 59, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  color: var(--text-white);
  font-family: inherit;
  font-size: 0.95rem;
  transition: var(--transition-smooth);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
}

.form-group textarea {
  resize: none !important;
  min-height: 96px;
  line-height: 1.5;
}

[data-theme="light"] .form-group input,
[data-theme="light"] .form-group textarea {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #0f172a;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.form-group input:hover,
.form-group textarea:hover {
  border-color: rgba(59, 130, 246, 0.4);
  background: rgba(30, 41, 59, 0.6);
}

[data-theme="light"] .form-group input:hover,
[data-theme="light"] .form-group textarea:hover {
  background: #ffffff;
  border-color: #cbd5e1;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(30, 41, 59, 0.75);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2), inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .form-group input:focus,
[data-theme="light"] .form-group textarea:focus {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.form-group input.is-invalid,
.form-group textarea.is-invalid {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25) !important;
}

.field-error-hint {
  display: block;
  font-size: 0.8rem;
  color: #ef4444;
  margin-top: 6px;
  font-weight: 500;
}

/* Step 4: Metodi di Pagamento */
.payment-methods-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.payment-option {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  cursor: pointer;
  display: block;
  transition: var(--transition-smooth);
  background: rgba(255, 255, 255, 0.02);
  position: relative;
}

.payment-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
  pointer-events: none;
}

.payment-option:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.payment-option.selected {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.08);
}

.payment-option-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.payment-radio-circle {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border-light);
  position: relative;
  flex-shrink: 0;
  transition: var(--transition-smooth);
}

.payment-option.selected .payment-radio-circle {
  border-color: var(--primary);
}

.payment-option.selected .payment-radio-circle::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
}

.payment-info-text {
  flex-grow: 1;
}

.payment-info-text strong {
  display: block;
  font-size: 0.95rem;
  color: var(--text-white);
  margin-bottom: 2px;
}

.payment-info-text span {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.payment-icons i {
  width: 28px;
  height: 28px;
  color: var(--text-secondary);
}

/* Colonna Riepilogo Carrello (Sticky) */
.checkout-summary-column {
  position: sticky;
  top: 96px;
}

.order-summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-card);
}

.summary-title {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.summary-items-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.9rem;
}

.summary-item.hidden {
  display: none !important;
}

.summary-item strong {
  color: var(--text-white);
  font-size: 0.92rem;
}

.summary-item-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.summary-item-price {
  font-weight: 700;
  color: var(--text-white);
  white-space: nowrap;
}

.text-accent {
  color: var(--accent) !important;
}

.summary-divider {
  height: 1px;
  background: var(--border-light);
  margin: 18px 0;
}

.summary-totals {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.total-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.92rem;
  color: var(--text-secondary);
}

.total-row.total-highlight {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-white);
  padding-top: 10px;
  border-top: 1px solid var(--border-light);
}

.total-row.total-highlight span:last-child {
  color: var(--primary-light);
}

[data-theme="light"] .total-row.total-highlight span:last-child {
  color: var(--primary);
}

.tax-deductible-box {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.tax-deductible-box i {
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 2px;
}

.tax-deductible-box strong {
  display: block;
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 2px;
}

.tax-deductible-box p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin: 0;
}

.shipping-timeline-box {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 24px;
  text-align: left;
}

[data-theme="light"] .shipping-timeline-box {
  background: rgba(37, 99, 235, 0.06);
  border-color: rgba(37, 99, 235, 0.3);
}

.shipping-timeline-box i {
  color: var(--primary);
  flex-shrink: 0;
  margin-top: 2px;
  width: 18px;
  height: 18px;
}

.shipping-timeline-box strong {
  display: block;
  font-size: 0.86rem;
  color: var(--text-white);
  margin-bottom: 3px;
}

[data-theme="light"] .shipping-timeline-box strong {
  color: #0f172a;
}

.shipping-timeline-box p {
  font-size: 0.80rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin: 0;
}

.security-footer-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* Modal Feedback Ordine */
.order-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.order-modal-backdrop.hidden {
  display: none !important;
}

.order-modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  padding: 40px 32px;
  text-align: center;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
}

.modal-icon-wrap {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.modal-icon-wrap i {
  width: 36px;
  height: 36px;
}

.order-modal-content h3 {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.order-modal-content p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.modal-details-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin: 20px 0;
  text-align: left;
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Stili Step Legale & Checkbox Click-wrap */
.legal-checkboxes-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 8px;
}

.legal-checkbox-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

[data-theme="light"] .legal-checkbox-item {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.legal-checkbox-item:hover {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.04);
}

.legal-checkbox-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

.legal-checkbox-text {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.legal-checkbox-text strong {
  color: var(--text-white);
}

.legal-link {
  color: var(--primary);
  text-decoration: underline;
  font-weight: 600;
  transition: var(--transition);
}

.legal-link:hover {
  color: var(--primary-hover);
}

.legal-validation-note {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary);
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-top: 16px;
  font-size: 0.88rem;
  font-weight: 500;
}

[data-theme="light"] .legal-validation-note {
  background: rgba(37, 99, 235, 0.06);
  border-color: rgba(37, 99, 235, 0.2);
  color: #1d4ed8;
}

/* Toggle Amministratore Separato */
.admin-toggle-wrapper {
  margin-top: 6px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-md);
  transition: var(--transition-smooth);
}

.admin-toggle-wrapper:hover {
  border-color: rgba(59, 130, 246, 0.4);
  background: rgba(59, 130, 246, 0.03);
}

[data-theme="light"] .admin-toggle-wrapper {
  background: #f8fafc;
  border-color: #cbd5e1;
}

[data-theme="light"] .admin-toggle-wrapper:hover {
  background: #eff6ff;
  border-color: #93c5fd;
}

.admin-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  cursor: pointer;
  user-select: none;
}

.admin-checkbox-label input {
  display: none;
}

.admin-checkbox-label .custom-checkbox {
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--border-light);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  transition: var(--transition-smooth);
}

[data-theme="light"] .admin-checkbox-label .custom-checkbox {
  background: #ffffff;
  border-color: #cbd5e1;
}

.admin-checkbox-label input:checked ~ .custom-checkbox {
  background: var(--primary);
  border-color: var(--primary);
}

.admin-checkbox-label input:checked ~ .custom-checkbox::after {
  content: "";
  width: 5px;
  height: 10px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

.admin-toggle-text strong {
  display: block;
  font-size: 0.92rem;
  color: var(--text-primary);
  margin-bottom: 2px;
}

[data-theme="light"] .admin-toggle-text strong {
  color: #0f172a;
}

.admin-toggle-text p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
}

/* Box Amministratore Espandibile */
.separate-admin-box.hidden,
.hidden {
  display: none !important;
}

.separate-admin-box {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(139, 92, 246, 0.05) 100%);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-md);
  padding: 24px 26px;
  margin-top: 6px;
  animation: fadeInDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] .separate-admin-box {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(241, 245, 249, 0.9) 100%);
  border: 1px solid rgba(37, 99, 235, 0.3);
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.06);
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.separate-admin-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .separate-admin-header {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.admin-icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.admin-icon-wrap i {
  width: 22px;
  height: 22px;
}

.separate-admin-header h4 {
  font-size: 1.1rem;
  margin-bottom: 3px;
  color: var(--text-white);
  font-weight: 700;
}

[data-theme="light"] .separate-admin-header h4 {
  color: #0f172a;
}

.separate-admin-header p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
}

.admin-fields-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.admin-fields-grid .form-group {
  width: 100%;
}

.admin-fields-grid input {
  font-size: 1rem;
  padding: 15px 18px;
}

/* Responsive */
@media (max-width: 1024px) {
  .checkout-layout {
    grid-template-columns: 1fr;
  }
  .accessories-grid {
    grid-template-columns: 1fr;
  }
  .checkout-summary-column {
    position: static;
  }
  .hide-mobile {
    display: none;
  }
}

@media (max-width: 640px) {
  .checkout-form-grid {
    grid-template-columns: 1fr;
  }
  .form-group.span-2 {
    grid-column: span 1;
  }
  .plan-selection-main {
    flex-direction: column;
  }
  .plan-price {
    text-align: left;
    margin-top: 10px;
  }
}
