/* SM CUSTOM FORM - STILI PUBBLICI */

/* === CONTAINER PRINCIPALE === */
.sm-custom-form-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* === TITOLO PRINCIPALE === */
.sm-form-title {
  text-align: center;
  color: #6a1b9a;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 30px;
  line-height: 1.3;
}

/* === STEP 1 - SELEZIONE TIPO UTENTE === */
.sm-user-type-selection {
  display: block;
  margin-bottom: 30px;
}

.sm-user-type-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

.sm-user-type-option {
  position: relative;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #fff;
}

.sm-user-type-option:hover {
  border-color: #6a1b9a;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(106, 27, 154, 0.15);
}

.sm-user-type-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.sm-user-type-option input[type="radio"]:checked + label {
  color: #6a1b9a;
}

.sm-user-type-option input[type="radio"]:checked ~ .sm-user-type-option {
  border-color: #6a1b9a;
  background: #f3e5f5;
}

.sm-user-type-option label {
  display: block;
  cursor: pointer;
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin-top: 15px;
  transition: color 0.3s ease;
}

.sm-user-type-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 15px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
  transition: all 0.3s ease;
}

.sm-user-type-icon img {
  width: 50px;
  height: 50px;
  object-fit: contain;
  /* FIXA: Rimuovi filtro bianco e nero */
  filter: none;
  transition: transform 0.3s ease;
}

/* FIXA: HOVER SENZA FILTRO BIANCO */
.sm-user-type-option:hover .sm-user-type-icon {
  background: #6a1b9a;
  transform: scale(1.05);
}

.sm-user-type-option:hover .sm-user-type-icon img {
  /* FIXA: Rimuovi il filtro che rendeva l'immagine bianca */
  filter: brightness(0) invert(1);
  transform: scale(1.1);
}

/* FIXA: STATO SELEZIONATO */
.sm-user-type-option input[type="radio"]:checked + label .sm-user-type-icon {
  background: #6a1b9a;
}

.sm-user-type-option input[type="radio"]:checked + label .sm-user-type-icon img {
  filter: brightness(0) invert(1);
}

/* === FORM PRINCIPALE === */
.sm-custom-form {
  display: none;
}

.sm-form-fields {
  display: none;
}

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

.sm-form-group {
  margin-bottom: 20px;
}

.sm-form-group.full-width {
  grid-column: 1 / -1;
}

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

.sm-form-label.required::after {
  content: " *";
  color: #e53e3e;
}

.sm-form-input,
.sm-form-select,
.sm-form-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
  transition: all 0.3s ease;
  background: #fff;
  box-sizing: border-box;
}

.sm-form-input:focus,
.sm-form-select:focus,
.sm-form-textarea:focus {
  outline: none;
  border-color: #6a1b9a;
  box-shadow: 0 0 0 3px rgba(106, 27, 154, 0.1);
}

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

.sm-form-file {
  padding: 8px;
  border: 2px dashed #e0e0e0;
  border-radius: 8px;
  background: #fafafa;
  cursor: pointer;
  transition: all 0.3s ease;
}

.sm-form-file:hover {
  border-color: #6a1b9a;
  background: #f3e5f5;
}

/* === CHECKBOX CHIAMATA === */
.sm-call-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.sm-call-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #6a1b9a;
}

.sm-call-checkbox label {
  font-weight: 500;
  color: #495057;
  cursor: pointer;
  margin: 0;
}

/* === CAMPI CHIAMATA === */
.sm-call-fields {
  display: none;
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #e9ecef;
  margin-top: 15px;
}

.sm-timepicker-container {
  display: none;
  margin-top: 15px;
}

/* === BOTTONI === */
.sm-form-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 30px;
  flex-wrap: wrap;
}

.sm-btn {
  padding: 12px 30px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 140px;
}

.sm-btn-primary {
  background: #6a1b9a;
  color: white;
}

.sm-btn-primary:hover {
  background: #4a148c;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(106, 27, 154, 0.3);
}

.sm-btn-primary:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.sm-btn-secondary {
  background: #f5f5f5;
  color: #333;
  border: 2px solid #e0e0e0;
}

.sm-btn-secondary:hover {
  background: #e0e0e0;
  border-color: #ccc;
}

.sm-back-button {
  display: none;
}

/* === MESSAGGI === */
.sm-form-message {
  padding: 15px 20px;
  border-radius: 8px;
  margin: 20px 0;
  font-weight: 500;
  text-align: center;
  display: none;
}

.sm-form-message.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.sm-form-message.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .sm-custom-form-container {
    margin: 10px;
    padding: 15px;
  }

  .sm-user-type-options {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .sm-form-row {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .sm-form-title {
    font-size: 24px;
    margin-bottom: 20px;
  }

  .sm-user-type-option {
    padding: 20px 15px;
  }

  .sm-user-type-icon {
    width: 60px;
    height: 60px;
  }

  .sm-user-type-icon img {
    width: 35px;
    height: 35px;
  }

  .sm-form-buttons {
    flex-direction: column;
    align-items: center;
  }

  .sm-btn {
    width: 100%;
    max-width: 300px;
  }
}

@media (max-width: 480px) {
  .sm-custom-form-container {
    margin: 5px;
    padding: 10px;
  }

  .sm-form-title {
    font-size: 20px;
  }

  .sm-user-type-option {
    padding: 15px 10px;
  }

  .sm-form-input,
  .sm-form-select,
  .sm-form-textarea {
    font-size: 16px; /* Previene zoom su iOS */
  }
}

/* === ANIMAZIONI === */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    max-height: 0;
    opacity: 0;
  }
  to {
    max-height: 500px;
    opacity: 1;
  }
}

.sm-fade-in {
  animation: fadeIn 0.3s ease-out;
}

.sm-slide-down {
  animation: slideDown 0.3s ease-out;
}

/* === ACCESSIBILITÀ === */
.sm-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus visibile per accessibilità */
.sm-user-type-option:focus-within {
  outline: 2px solid #6a1b9a;
  outline-offset: 2px;
}

.sm-form-input:focus,
.sm-form-select:focus,
.sm-form-textarea:focus {
  outline: 2px solid #6a1b9a;
  outline-offset: 2px;
}

/* === LOADING STATES === */
.sm-loading {
  position: relative;
  pointer-events: none;
}

.sm-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #fff;
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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