/* ===== CONSULTATION FORM STYLES v21 ===== */

/* ===== HERO SECTION - Responsive Padding ===== */

/* Hero Section Consultation: Responsive padding-top for better mobile/tablet UX */
/* IMPORTANTE: Uso #hero per aumentare specificità e sovrascrivere tailwind.css */
#hero.hero-consultation {
  padding-top: 120px; /* Mobile: ridotto per non sprecare spazio */
  padding-bottom: 80px;
}

/* Tablet: padding intermedio */
@media (min-width: 768px) {
  #hero.hero-consultation {
    padding-top: 140px;
  }
}

/* Desktop: padding ottimale */
@media (min-width: 1024px) {
  #hero.hero-consultation {
    padding-top: 220px !important; /* Valore ottimale bilanciato */
  }
}

/* =====  RESPONSIVE CONTAINER CLASSES ===== */

/* Form Container: Max-width 800px for main form areas */
.form-container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Form Container Narrow: Max-width 600px for narrower sections */
.form-container-narrow {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Button Group Right: Flex container for buttons aligned right */
.button-group-right {
  display: flex;
  justify-content: flex-end;
  margin-top: 32px;
  gap: 24px;
  flex-wrap: wrap;
}

/* Button Group Large Gap: Larger margin top for more spacing */
.button-group-right.button-group-large-gap {
  margin-top: 48px;
}

/* Label with Padding: Small left padding for labels */
.label-with-padding {
  padding-left: 5px;
}

/* AI Response Wrapper: Flex container for AI icon and content */
.ai-response-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 32px;
}

/* AI Icon Wrapper: Container for AI icon (flex-shrink to prevent squishing) */
.ai-icon-wrapper {
  flex-shrink: 0;
}

/* AI Response Content: Flexible container for AI text response */
.ai-response-content {
  flex: 1;
  min-width: 0; /* Allows proper text wrapping */
}

/* AI Response Text: Styling for the AI-generated text */
.ai-response-text {
  color: var(--text-primary);
  font-size: 18px;
  line-height: 1.8;
  text-align: left;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* AI Response Buttons: Flex container for confirm/modify buttons */
.ai-response-buttons {
  display: flex;
  flex-direction: column;
  gap: 16px;
  justify-content: flex-end;
}

/* Responsive Adjustments for Tablet */
@media (min-width: 640px) {
  .ai-response-buttons {
    flex-direction: row;
  }

  .form-container {
    padding: 0 24px;
  }

  .form-container-narrow {
    padding: 0 24px;
  }
}

/* Responsive Adjustments for Mobile */
@media (max-width: 640px) {
  .button-group-right {
    gap: 12px;
  }

  .ai-response-wrapper {
    gap: 12px;
  }

  .ai-response-text {
    font-size: 16px;
    line-height: 1.6;
  }

  .form-container {
    padding: 0 12px;
  }

  .form-container-narrow {
    padding: 0 12px;
  }
}

/* Override CTA styles for consultation page */
.cta-secondary {
  border: none !important;
}

.cta-primary {
  border: none !important;
}

/* Remove pulse effect */
.cta-pulse {
  animation: none !important;
}

.cta-pulse::before,
.cta-pulse::after {
  display: none !important;
}

/* Utility Classes */
.w-16 {
  width: 4rem;
}

.h-16 {
  height: 4rem;
}

.w-8 {
  width: 2rem;
}

.h-8 {
  height: 2rem;
}

.w-6 {
  width: 1.5rem;
}

.h-6 {
  height: 1.5rem;
}

.w-5 {
  width: 1.25rem;
}

.h-5 {
  height: 1.25rem;
}

.w-4 {
  width: 1rem;
}

.h-4 {
  height: 1rem;
}

.gap-6 {
  gap: 1.5rem;
}

.text-left {
  text-align: left;
}

/* Form Steps Management */
.form-step {
  display: none;
  animation: fadeIn 0.5s ease-in-out;
}

.form-step.active {
  display: block;
}

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

/* Pulse effect with waves for CTA */
.cta-pulse {
  position: relative;
  animation: subtle-pulse 2s ease-in-out infinite;
}

.cta-pulse::before,
.cta-pulse::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  border: 2px solid var(--accent-primary);
  opacity: 0;
  transform: translate(-50%, -50%);
  animation: wave-propagation 2s ease-out infinite;
}

.cta-pulse::after {
  animation-delay: 1s;
}

@keyframes subtle-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
}

@keyframes wave-propagation {
  0% {
    width: 100%;
    height: 100%;
    opacity: 0.8;
  }
  100% {
    width: 140%;
    height: 140%;
    opacity: 0;
  }
}

/* Consultation Options (Step 1) */
.consultation-option {
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s var(--ease-smooth);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.consultation-option:hover {
  border-color: var(--accent-primary);
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), 0 0 24px rgba(79, 156, 255, 0.4);
}

.option-icon {
  width: 80px;
  height: 80px;
  background: var(--bg-elevated);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
  transition: all 0.3s var(--ease-smooth);
}

.consultation-option:hover .option-icon {
  background: var(--accent-primary);
  color: var(--bg-primary);
  transform: scale(1.1);
}

.option-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.option-description {
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin: 0;
}

/* Form Fields */
.form-group {
  margin-bottom: 24px;
}

.form-label {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.form-textarea {
  width: 100%;
  padding: 16px;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.6;
  resize: vertical;
  transition: all 0.3s var(--ease-smooth);
  font-family: 'Roboto', sans-serif;
}

.form-textarea:focus,
.form-textarea.has-content {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 24px rgba(79, 156, 255, 0.4), 0 0 0 3px rgba(79, 156, 255, 0.1);
}

.form-textarea::placeholder {
  color: var(--text-label);
  font-style: italic;
}

/* Loading State - AI Asterisk Icon */
.ai-loading-icon {
  animation: ai-loading-pulse 2s ease-in-out infinite;
}

.ai-loading-icon svg {
  animation: ai-loading-rotate 3s linear infinite;
  filter: drop-shadow(0 0 20px rgba(79, 156, 255, 0.6));
}

@keyframes ai-loading-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.15);
  }
}

@keyframes ai-loading-rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Back Button */
.back-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s var(--ease-smooth);
}

.back-button:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: rgba(79, 156, 255, 0.05);
  transform: translateX(-3px);
}

.back-button svg {
  transition: transform 0.3s var(--ease-smooth);
}

.back-button:hover svg {
  transform: translateX(-2px);
}

/* Bottom Bar with Button and Tags */
.textarea-bottom-bar {
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 10;
}

/* Service Tags Container (inline) */
.selected-tags-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.service-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--accent-primary);
  color: var(--bg-primary);
  border: none;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s var(--ease-smooth);
}

.service-tag-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  color: var(--bg-primary);
  transition: all 0.2s var(--ease-smooth);
}

.service-tag-remove:hover {
  background: rgba(0, 0, 0, 0.2);
}

.service-tag-remove svg {
  width: 8px;
  height: 8px;
}

/* Add Service Button */
.add-service-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s var(--ease-smooth);
}

.add-service-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: rgba(79, 156, 255, 0.05);
}

.add-service-btn.active {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: rgba(79, 156, 255, 0.1);
  transform: rotate(45deg);
}

/* Services Dropdown */
.services-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 10px;
  width: 180px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  z-index: 100;
  animation: dropdownSlideDown 0.2s var(--ease-smooth);
}

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

.services-dropdown.hidden {
  display: none;
}

.services-list {
  padding: 4px;
}

.service-option {
  width: 100%;
  display: block;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s var(--ease-smooth);
}

.service-option:hover {
  background: var(--bg-secondary);
}

.service-option.selected {
  background: rgba(79, 156, 255, 0.1);
  color: var(--accent-primary);
  font-weight: 500;
}

/* Form Sections and Fields */
.form-section {
  margin-bottom: 40px;
}

.form-section-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.form-input,
.form-select {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 15px;
  font-family: 'Roboto', sans-serif;
  transition: all 0.3s var(--ease-smooth);
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(79, 156, 255, 0.1);
}

.required {
  color: var(--accent-primary);
}

/* Radio Buttons with Icons */
.radio-group {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.radio-option-icon {
  flex: 1;
  min-width: 150px;
  cursor: pointer;
  position: relative;
}

.radio-option-icon input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.radio-icon-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: 12px;
  transition: all 0.3s var(--ease-smooth);
}

.radio-option-icon:hover .radio-icon-content {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.radio-option-icon input[type="radio"]:checked + .radio-icon-content {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.radio-option-icon input[type="radio"]:checked + .radio-icon-content .radio-icon {
  color: var(--bg-primary);
}

.radio-option-icon input[type="radio"]:checked + .radio-icon-content .radio-label {
  color: var(--bg-primary);
  font-weight: 600;
}

.radio-icon {
  width: 32px;
  height: 32px;
  color: var(--text-secondary);
  transition: all 0.3s var(--ease-smooth);
}

.radio-label {
  font-size: 15px;
  color: var(--text-primary);
  transition: all 0.3s var(--ease-smooth);
  text-align: center;
}

/* Form Row (two columns) */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* AI Summary Box */
.ai-summary-box {
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 40px;
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.6;
}

/* Responsive */
@media (max-width: 768px) {
  .consultation-option {
    padding: 24px 16px;
  }

  .option-icon {
    width: 64px;
    height: 64px;
  }

  .option-icon svg {
    width: 2rem;
    height: 2rem;
  }

  .option-title {
    font-size: 20px;
  }

  .option-description {
    font-size: 14px;
  }
}
