/* ═══════════════════════ FORM INPUTS ═══════════════════════ */
.form-group {
  margin-bottom: 1.5rem;
}
.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}
.form-label .optional {
  font-weight: 400;
  color: var(--text-secondary);
  font-size: 0.8rem;
}
.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 0.85rem 1.1rem;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 0.92rem;
  transition: border-color 0.3s, box-shadow 0.3s;
  outline: none;
}
.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--indigo-light);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-tertiary);
}
.form-input.error,
.form-textarea.error,
.form-select.error {
  border-color: var(--red-soft);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.08);
}
.form-textarea {
  min-height: 150px;
  resize: vertical;
  line-height: 1.6;
}
.form-select {
  appearance: none;
  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='%239aa3b4' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}
.form-helper {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 0.4rem;
}
.form-error {
  font-size: 0.78rem;
  color: var(--red-soft);
  margin-top: 0.4rem;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.form-row-3 {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 1rem;
}
.char-count {
  text-align: right;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.3rem;
}
.char-count.warn {
  color: var(--amber);
}
.char-count.over {
  color: var(--red-soft);
}

/* ─── Describe Step Coaching Hints ─── */
.describe-hints {
  background: rgba(99,102,241,0.06);
  border: 1px solid rgba(99,102,241,0.15);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.describe-hints-label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--indigo-light);
  margin-bottom: 0.5rem;
}
.describe-hints-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.describe-hints-list li {
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 0.2rem 0;
  padding-left: 1.25rem;
  position: relative;
  line-height: 1.5;
}
.describe-hints-list li::before {
  content: '\2192';
  position: absolute;
  left: 0;
  color: var(--indigo-light);
}

/* ═══════════════════════ TOAST NOTIFICATIONS ═══════════════════════ */
.toast-container {
  position: fixed;
  top: 5rem;
  right: 1.5rem;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.toast {
  padding: 1rem 1.5rem;
  border-radius: 10px;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  animation: slideIn 0.3s ease, fadeOut 0.3s ease 3.7s forwards;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.toast-success {
  background: var(--green-bg);
  border: 1px solid rgba(22, 163, 74, 0.2);
  color: var(--green);
}
.toast-error {
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.2);
  color: var(--red-soft);
}
.toast-info {
  background: var(--indigo-bg);
  border: 1px solid rgba(79, 70, 229, 0.2);
  color: var(--indigo-light);
}
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes fadeOut {
  to { opacity: 0; transform: translateY(-10px); }
}

/* ═══════════════════════ LOADING ═══════════════════════ */
.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(79, 70, 229, 0.15);
  border-top-color: var(--indigo-light);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.loading-spinner.sm {
  width: 18px;
  height: 18px;
  border-width: 2px;
}
.loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  gap: 1.5rem;
}
.loading-text {
  font-size: 0.92rem;
  color: var(--text-secondary);
}
.loading-subtext {
  font-size: 0.8rem;
  color: rgba(154, 163, 180, 0.6);
}

/* ═══════════════════════ STATUS BADGES ═══════════════════════ */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.8rem;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.status-draft {
  background: rgba(154, 163, 180, 0.15);
  color: var(--text-secondary);
}
.status-analyzing,
.status-letter_generating {
  background: var(--indigo-bg);
  color: var(--indigo-light);
}
.status-analyzed {
  background: var(--amber-bg);
  color: var(--amber);
}
.status-letter_ready {
  background: var(--amber-bg);
  color: var(--amber);
}
.status-letter_approved,
.status-complete {
  background: rgba(78, 203, 113, 0.15);
  color: var(--green);
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ═══════════════════════ CARDS ═══════════════════════ */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  transition: all 0.3s;
}
.card:hover {
  border-color: rgba(79, 70, 229, 0.2);
}
.card-clickable {
  cursor: pointer;
}
.card-clickable:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ═══════════════════════ EMPTY STATE ═══════════════════════ */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
}
.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1.5rem;
  opacity: 0.5;
}
.empty-state h3 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.5rem;
  color: var(--ink);
  margin-bottom: 0.8rem;
}
.empty-state p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 2rem;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

/* ═══════════════════════ AI PROCESSING PROGRESS ═══════════════════════ */
.ai-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3rem 2rem;
  gap: 2rem;
}
.ai-progress-bar-wrap {
  width: 100%;
  max-width: 400px;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.ai-progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--indigo-light), var(--indigo));
  transition: width 0.6s ease;
  width: 0%;
}
.ai-progress-steps {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
  max-width: 400px;
}
.ai-progress-step {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.88rem;
  color: var(--text-tertiary);
  transition: color 0.4s, opacity 0.4s;
}
.ai-progress-step.active {
  color: var(--indigo-light);
}
.ai-progress-step.done {
  color: var(--green);
}
.ai-progress-step-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 700;
}
.ai-progress-step.active .ai-progress-step-icon {
  animation: pulse 1.2s ease-in-out infinite;
}
.ai-progress-eta {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* ═══════════════════════ CASE JOURNEY TIMELINE ═══════════════════════ */
.case-journey {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 2.5rem;
  padding: 1.25rem 1.5rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-x: auto;
}
.journey-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.journey-step:not(:last-child)::after {
  content: '';
  display: block;
  width: 32px;
  height: 2px;
  background: var(--border);
  margin: 0 0.25rem;
  flex-shrink: 0;
}
.journey-step.done:not(:last-child)::after {
  background: var(--green);
}
.journey-step.active:not(:last-child)::after {
  background: linear-gradient(90deg, var(--indigo-light), var(--border));
}
.journey-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
  flex-shrink: 0;
  background: var(--surface-alt);
  border: 2px solid var(--border);
  color: var(--text-secondary);
}
.journey-step.done .journey-dot {
  background: var(--green-bg);
  border-color: var(--green);
  color: var(--green);
}
.journey-step.active .journey-dot {
  background: var(--indigo-bg);
  border-color: var(--indigo-light);
  color: var(--indigo-light);
  animation: pulse 2s ease-in-out infinite;
}
.journey-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  white-space: nowrap;
  font-weight: 500;
}
.journey-step.done .journey-label {
  color: var(--green);
}
.journey-step.active .journey-label {
  color: var(--indigo-light);
  font-weight: 600;
}

/* ═══════════════════════ DASHBOARD CASE PROGRESS ═══════════════════════ */
.case-progress-bar {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 0.5rem;
}
.case-progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease;
}
.case-progress-fill.progress-draft { width: 15%; background: var(--text-secondary); }
.case-progress-fill.progress-analyzing { width: 30%; background: var(--indigo-light); animation: pulse 1.2s ease-in-out infinite; }
.case-progress-fill.progress-analyzed { width: 50%; background: var(--amber); }
.case-progress-fill.progress-letter_generating { width: 65%; background: var(--indigo-light); animation: pulse 1.2s ease-in-out infinite; }
.case-progress-fill.progress-letter_ready { width: 85%; background: var(--green); }
.case-progress-fill.progress-letter_approved { width: 100%; background: var(--green); }

/* ═══════════════════════ WELCOME MODAL ═══════════════════════ */
.welcome-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}
.welcome-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3rem;
  max-width: 520px;
  width: 90%;
  text-align: center;
  animation: fadeInUp 0.4s ease;
  box-shadow: var(--shadow-lg);
}
.welcome-card h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.8rem;
  color: var(--ink);
  margin-bottom: 0.5rem;
}
.welcome-card .welcome-sub {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 2rem;
  line-height: 1.6;
}
.welcome-steps {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
  text-align: left;
}
.welcome-step {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.welcome-step-num {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 8px;
  background: var(--indigo-light);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}
.welcome-step-text {
  flex: 1;
}
.welcome-step-text strong {
  display: block;
  color: var(--ink);
  font-size: 0.9rem;
  margin-bottom: 0.15rem;
}
.welcome-step-text span {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ═══════════════════════ SUBMISSION CONFIRMATION ═══════════════════════ */
.submit-confirm {
  text-align: center;
  padding: 3rem 2rem;
  animation: fadeInUp 0.5s ease;
}
.submit-confirm-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(78, 203, 113, 0.15);
  border: 2px solid var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin: 0 auto 1.5rem;
  animation: scaleIn 0.4s ease 0.2s both;
}
.submit-confirm h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.6rem;
  color: var(--ink);
  margin-bottom: 0.5rem;
}
.submit-confirm p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.7;
  max-width: 450px;
  margin: 0 auto 1.5rem;
}
.submit-confirm-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  max-width: 400px;
  margin: 0 auto 2rem;
  text-align: left;
}
.submit-confirm-detail {
  padding: 0.75rem 1rem;
  background: var(--surface-alt);
  border-radius: 8px;
}
.submit-confirm-detail-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 0.15rem;
}
.submit-confirm-detail-value {
  font-size: 0.9rem;
  color: var(--ink);
  font-weight: 600;
}
.submit-what-next {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 400px;
  margin: 0 auto 2rem;
  text-align: left;
}
.submit-what-next-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.submit-what-next-item .next-icon {
  color: var(--indigo-light);
  font-weight: 700;
  font-size: 0.7rem;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--indigo-bg);
  border-radius: 50%;
  flex-shrink: 0;
}
@keyframes scaleIn {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ═══════════════════════ STRENGTH ANIMATION ═══════════════════════ */
.strength-score-animated {
  animation: fadeInUp 0.5s ease;
}
.strength-bar-fill.animate-in {
  animation: fillBar 1s ease 0.3s both;
}
@keyframes fillBar {
  from { width: 0%; }
}

/* ═══════════════════════ WIZARD ENCOURAGEMENT ═══════════════════════ */
.wizard-encouragement {
  text-align: center;
  padding: 0.5rem 1rem;
  font-size: 0.82rem;
  color: var(--indigo-light);
  font-weight: 500;
  animation: fadeIn 0.4s ease;
  margin-top: 0.5rem;
}

/* ═══════════════════════ RESPONSIVE ═══════════════════════ */
@media (max-width: 640px) {
  .form-row,
  .form-row-3 {
    grid-template-columns: 1fr;
  }
  .toast-container {
    right: 0.5rem;
    left: 0.5rem;
  }
  .toast {
    max-width: 100%;
  }
  .case-journey {
    padding: 1rem;
  }
  .journey-label {
    display: none;
  }
  .journey-step:not(:last-child)::after {
    width: 16px;
  }
  .welcome-card {
    padding: 2rem 1.5rem;
  }
  .submit-confirm-details {
    grid-template-columns: 1fr;
  }
  .ai-progress-steps {
    max-width: 100%;
  }
}
