/* WIZARD DONAZIONE CAMPAGNA - ZELANIA DESIGN SYSTEM */
/* Version: 2.1 */

/* RESET E BASE */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  padding: 20px;
  line-height: 1.6;
  color: #333;
  min-height: 100vh;
}

/* CONTAINER PRINCIPALE */
#wizard {
  max-width: 800px;
  margin: 0 auto;
  background: white;
  border-radius: 16px;
  padding: 0;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

/* HEADER WIZARD */
.wizard-header {
  background: #f8f9fa;
  color: #333;
  padding: 30px;
  text-align: center;
  position: relative;
  border-bottom: 1px solid #e9ecef;
}

.wizard-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: #333;
}

.wizard-subtitle {
  font-size: 1rem;
  font-weight: 400;
  color: #6c757d;
}

/* PROGRESS BAR */
.wizard-progress {
  background: #f8f9fa;
  padding: 20px 30px;
  border-bottom: 1px solid #e9ecef;
}

.progress-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.progress-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: #6c757d;
  font-weight: 500;
}

.progress-step.active {
  color: #2c5aa0;
  font-weight: 600;
}

.progress-step.completed {
  color: #28a745;
}

.step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e9ecef;
  color: #6c757d;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.8rem;
}

.progress-step.active .step-number {
  background: #a0b325;
  color: white;
}

.progress-step.completed .step-number {
  background: #28a745;
  color: white;
}

.progress-bar {
  height: 6px;
  background: #e9ecef;
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: #a0b325;
  transition: width 0.5s ease;
  border-radius: 3px;
}

/* STEPS CONTAINER */
.wizard-content {
  padding: 40px;
}

.step {
  display: none;
  animation: fadeInUp 0.4s ease-out;
}

.step.active {
  display: block;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.step-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.step-description {
  color: #6c757d;
  margin-bottom: 30px;
  font-size: 1rem;
}

/* FORM ELEMENTS - ZELANIA STYLE */
.form-group {
  margin-bottom: 25px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-label {
  display: block;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.form-label.required::after {
  content: ' *';
  color: #dc3545;
}

.form-label.optional::after {
  content: ' (facoltativo)';
  color: #6c757d;
  font-weight: 400;
  font-size: 0.85rem;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  font-size: 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  transition: all 0.3s ease;
  background: #fff;
}

.form-control:focus {
  outline: none;
  border-color: #a0b325;
  box-shadow: 0 0 0 3px rgba(160, 179, 37, 0.1);
}

.form-control.error {
  border-color: #dc3545;
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

select.form-control {
  cursor: pointer;
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

/* CAMPAIGN SELECTION */
.campaign-card {
  border: 2px solid #e9ecef;
  border-radius: 12px;
  padding: 20px;
  margin-top: 15px;
  background: #f8f9fa;
  display: none;
  transition: all 0.3s ease;
}

.campaign-card.active {
  display: block;
  border-color: #a0b325;
  background: #f6f8f0;
}

.campaign-title {
  font-weight: 600;
  color: #a0b325;
  margin-bottom: 8px;
}

.campaign-description {
  color: #495057;
  font-size: 0.9rem;
  line-height: 1.5;
}

.campaign-stats {
  display: flex;
  gap: 20px;
  margin-top: 15px;
  font-size: 0.85rem;
}

.campaign-stat {
  color: #6c757d;
}

.campaign-stat strong {
  color: #a0b325;
}

/* AMOUNT CONFIGURATION */
.amount-config-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 15px;
  align-items: end;
}

.amount-item {
  background: #f8f9fa;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 15px;
  transition: all 0.3s ease;
}

.amount-item:hover {
  border-color: #a0b325;
  background: #f6f8f0;
}

/* AMOUNT SELECTION GRID */
.amount-selection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.amount-option {
  border: 2px solid #e9ecef;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: white;
  position: relative;
}

.amount-option:hover {
  border-color: #a0b325;
  background: #f6f8f0;
}

.amount-option.selected {
  border-color: #a0b325;
  background: #a0b325;
  color: white;
}

.amount-value {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 5px;
}

.amount-label {
  font-size: 0.85rem;
  opacity: 0.8;
}

.custom-amount-container {
  margin-top: 20px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 12px;
  border: 2px solid #e9ecef;
}

.custom-amount-container.active {
  border-color: #a0b325;
  background: #f6f8f0;
}

/* FREQUENCY SELECTION */
.frequency-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin-top: 10px;
}

.frequency-option {
  padding: 15px;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: white;
}

.frequency-option:hover {
  border-color: #a0b325;
  background: #f6f8f0;
}

.frequency-option.selected {
  border-color: #a0b325;
  background: #a0b325;
  color: white;
}

.frequency-title {
  font-weight: 600;
  margin-bottom: 5px;
}

.frequency-desc {
  font-size: 0.85rem;
  opacity: 0.8;
}

/* BUTTONS - ZELANIA STYLE */
.button-group {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin-top: 40px;
  padding-top: 30px;
  border-top: 1px solid #e9ecef;
}

.btn {
  padding: 14px 28px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.btn-primary {
  background: #a0b325;
  color: white;
}

.btn-primary:hover {
  background: #8a9d1f;
  box-shadow: 0 4px 12px rgba(160, 179, 37, 0.3);
}

.btn-secondary {
  background: #f8f9fa;
  color: #495057;
  border: 2px solid #e9ecef;
}

.btn-secondary:hover {
  border-color: #adb5bd;
  background: #e9ecef;
}

.btn-success {
  background: #a0b325;
  color: white;
}

.btn-success:hover {
  background: #8a9d1f;
  box-shadow: 0 4px 12px rgba(160, 179, 37, 0.3);
}

/* IFRAME OUTPUT */
.iframe-output {
  background: #f8f9fa;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  padding: 20px;
  margin-top: 20px;
}

.iframe-label {
  font-weight: 600;
  color: #a0b325;
  margin-bottom: 10px;
  display: block;
}

#iframe-code {
  font-family: 'Courier New', monospace;
  background: #2d3748;
  color: #e2e8f0;
  border: none;
  padding: 15px;
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.4;
  height: 120px;
}

/* LOADING STATE */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #a0b325;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* RESPONSIVE */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }
  
  #wizard {
    border-radius: 12px;
  }
  
  .wizard-header {
    padding: 20px;
  }
  
  .wizard-title {
    font-size: 1.5rem;
  }
  
  .wizard-content {
    padding: 25px;
  }
  
  .progress-container {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }
  
  .progress-step {
    justify-content: center;
  }
  
  .amount-config-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .frequency-options {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .form-row {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .button-group {
    flex-direction: column;
    gap: 10px;
  }
  
  .btn {
    width: 100%;
    justify-content: center;
  }
}

/* PREVIEW CONTAINERS */
.preview-container {
  background: #f8f9fa;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  padding: 25px;
  margin: 20px 0;
  position: relative;
}

.preview-container::before {
  content: "👀 ANTEPRIMA";
  position: absolute;
  top: -10px;
  left: 20px;
  background: #a0b325;
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.preview-note {
  background: #e7f3ff;
  border: 1px solid #b8daff;
  border-radius: 8px;
  padding: 15px;
  margin: 20px 0;
  color: #004085;
  font-size: 0.9rem;
}

.preview-note strong {
  color: #002752;
}

/* CONFIG SUMMARY */
.config-summary {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 25px;
}

.summary-card {
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 20px;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f1f3f4;
}

.summary-item:last-child {
  border-bottom: none;
}

.summary-item strong {
  color: #333;
  font-weight: 600;
}

.summary-item span, .summary-item a {
  color: #6c757d;
  text-align: right;
  max-width: 60%;
  word-break: break-word;
}

.summary-item a {
  color: #a0b325;
  text-decoration: none;
}

.summary-item a:hover {
  text-decoration: underline;
}

/* PREVIEW DISABLED INPUTS */
.preview-container .form-control:disabled {
  background-color: #f8f9fa;
  border-color: #e9ecef;
  color: #6c757d;
  cursor: not-allowed;
}

.preview-container .amount-option {
  pointer-events: none;
  opacity: 0.8;
}

.preview-container .frequency-option {
  pointer-events: none;
  opacity: 0.8;
}

/* UTILITIES */
.text-center { text-align: center; }
.hidden { display: none; }
.mb-0 { margin-bottom: 0; }
.mt-20 { margin-top: 20px; }

/* RIMUOVI TUTTE LE ICONE */
.step-title::before {
  display: none !important;
}

.step-title > *:first-child {
  display: none !important;
}

/* DATI AGGIUNTIVI - STILI */

.additional-data-toggle {
    margin: 25px 0;
    text-align: center;
}

.btn-additional-data {
    background: #f8f9fa;
    border: 2px dashed #a0b325;
    border-radius: 8px;
    padding: 12px 20px;
    color: #a0b325;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.btn-additional-data:hover {
    background: #f6f8f0;
    border-color: #8a9d1f;
    color: #8a9d1f;
    transform: translateY(-1px);
}

.btn-additional-data small {
    color: #6c757d;
    font-weight: 400;
    font-size: 0.8rem;
}

#toggle-icon {
    font-size: 1.2rem;
    font-weight: bold;
    transition: transform 0.3s ease;
}

.additional-data-section {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, opacity 0.3s ease-out;
    opacity: 0;
    margin-top: 0;
}

.additional-data-section.expanded {
    max-height: 1000px; /* Valore alto per contenere tutti i campi */
    opacity: 1;
    margin-top: 20px;
}

.section-divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.section-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e9ecef;
    z-index: 1;
}

.section-divider span {
    background: white;
    padding: 0 20px;
    font-size: 0.9rem;
    color: #6c757d;
    font-weight: 500;
    position: relative;
    z-index: 2;
}

/* Animazione icona rotazione */
.btn-additional-data.expanded #toggle-icon {
    transform: rotate(45deg);
}

/* Stili per campi aggiuntivi */
.additional-data-section .form-group {
    animation: slideInUp 0.3s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive per dati aggiuntivi */
@media (max-width: 768px) {
    .btn-additional-data {
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    .additional-data-section {
        max-height: none; /* Rimuove limitazione su mobile */
    }

    .additional-data-section.expanded {
        max-height: none;
    }
}

/* Focus states migliorati */
.additional-data-section .form-control:focus {
    border-color: #a0b325;
    box-shadow: 0 0 0 3px rgba(160, 179, 37, 0.1);
}

/* Stili per province select */
.additional-data-section select.form-control {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px 12px;
    padding-right: 40px;
}

/* Indicatore visivo per campi opzionali */
.additional-data-section .form-label::after {
    content: ' (opzionale)';
    color: #6c757d;
    font-weight: 400;
    font-size: 0.85rem;
}

/* Hover effect per tutta la sezione */
.additional-data-section.expanded {
    background: linear-gradient(135deg, rgba(160, 179, 37, 0.02), rgba(160, 179, 37, 0.01));
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
    border: 1px solid rgba(160, 179, 37, 0.1);
}
