/* ===============================
MODERN FORM DESIGN - VIGEO Health
=============================== */

:root {
  --sidebar-width: 280px;
  --form-max-width: 1200px;
  --brand-red: #af2d2c;
  --brand-dark: #7a1f1e;
  --brand-light: rgba(175, 45, 44, 0.1);
  --success-green: #10b981;
  --grey-50: #f9fafb;
  --grey-100: #f3f4f6;
  --grey-200: #e5e7eb;
  --grey-300: #d1d5db;
  --grey-500: #6b7280;
  --grey-700: #374151;
  --grey-900: #111827;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --transition-base: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset and Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body.caregiving-form {
  background: linear-gradient(135deg, #fef3f2 0%, #ffffff 50%, #fef3f2 100%);
  min-height: 100vh;
  font-family: 'Montserrat', sans-serif;
  color: var(--grey-900);
  padding-top: 72px; /* Match navbar height */
}

/* Ensure navbar styling is consistent on form page */
body.caregiving-form .main-navbar {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.05);
}

/* Form Section Container */
.form-section {
  max-width: var(--form-max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* Form Header */
.form-header {
  text-align: center;
  margin-bottom: 3rem;
  animation: fadeInDown 0.8s ease-out;
}

.form-header h2 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  color: var(--brand-dark);
  margin-bottom: 1rem;
  letter-spacing: -0.5px;
}

.form-header p {
  font-size: 1.125rem;
  color: var(--grey-500);
  max-width: 600px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

/* Progress Container */
.progress-container {
  position: relative;
  max-width: 600px;
  margin: 0 auto;
  height: 8px;
  background: var(--grey-200);
  border-radius: 100px;
  overflow: visible;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-red) 0%, var(--brand-dark) 100%);
  border-radius: 100px;
  width: 0%;
  transition: width 0.7s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  box-shadow: 0 2px 8px rgba(175, 45, 44, 0.3);
}

.progress-bar::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  background: white;
  border: 3px solid var(--brand-red);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(175, 45, 44, 0.3);
}

/* Progress Steps (optional) */
.progress-steps {
  display: flex;
  justify-content: space-between;
  max-width: 600px;
  margin: 0.5rem auto 0;
  font-size: 0.75rem;
  color: var(--grey-500);
}

/* Main Form Container */
.form-container {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  gap: 2rem;
  margin-top: 3rem;
}

/* Sidebar Navigation */
.form-sidebar {
  position: sticky;
  top: 100px;
  height: fit-content;
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  border: 1px solid var(--grey-100);
}

.form-sidebar h3 {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--grey-500);
  margin-bottom: 1.5rem;
}

.form-sidebar ul {
  list-style: none;
}

.form-sidebar li {
  position: relative;
  margin-bottom: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  color: var(--grey-600);
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition-base);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.form-sidebar li::before {
  content: attr(data-step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--grey-200);
  color: var(--grey-500);
  font-size: 0.75rem;
  font-weight: 600;
  transition: var(--transition-base);
}

.form-sidebar li:hover {
  background: var(--grey-50);
  color: var(--grey-700);
}

.form-sidebar li.active {
  background: var(--brand-light);
  color: var(--brand-red);
  font-weight: 600;
}

.form-sidebar li.active::before {
  background: var(--brand-red);
  color: white;
}

.form-sidebar li.completed::before {
  content: '✓';
  background: var(--success-green);
  color: white;
}

/* Form Content Area */
.form-content {
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  min-height: 500px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--grey-100);
}

.form-content fieldset {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 3rem;
  border: none;
  opacity: 0;
  transform: translateX(50px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  pointer-events: none;
  display: flex;
  flex-direction: column;
}

.form-content fieldset.active {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.form-content fieldset.active.slide-out-left {
  animation: slideOutLeft 0.5s ease forwards;
}

.form-content fieldset.slide-in-right {
  animation: slideInRight 0.5s ease forwards;
}

/* Step Introduction */
.step-intro {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--grey-900);
  margin-bottom: 2.5rem;
  line-height: 1.4;
  animation: fadeInUp 0.6s ease-out;
}

.step-subtitle {
  font-size: 1rem;
  color: var(--grey-500);
  margin-top: 0.5rem;
  font-weight: 400;
}

/* Form Fields */
.field-group {
  position: relative;
  margin-bottom: 2rem;
  animation: fadeInUp 0.6s ease-out 0.1s both;
}

.field-group:nth-child(3) {
  animation-delay: 0.2s;
}

.field-group input,
.field-group select,
.field-group textarea {
  width: 100%;
  padding: 1.25rem 1rem 0.75rem;
  font-size: 1rem;
  border: 2px solid var(--grey-200);
  border-radius: var(--radius-md);
  background: white;
  transition: var(--transition-base);
  font-family: 'Montserrat', sans-serif;
}

.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
  outline: none;
  border-color: var(--brand-red);
  box-shadow: 0 0 0 3px var(--brand-light);
}

.field-group label {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--grey-500);
  font-size: 1rem;
  font-weight: 500;
  pointer-events: none;
  transition: var(--transition-base);
  background: white;
  padding: 0 0.25rem;
}

.field-group input:focus + label,
.field-group input:not(:placeholder-shown) + label,
.field-group select:focus + label,
.field-group select:valid + label,
.field-group.filled label {
  top: 0;
  font-size: 0.75rem;
  color: var(--brand-red);
  font-weight: 600;
}

/* Option Cards */
.option-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.option-card {
  position: relative;
  padding: 2rem;
  background: white;
  border: 2px solid var(--grey-200);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition-base);
  text-align: center;
  animation: fadeInUp 0.6s ease-out 0.2s both;
}

.option-card:hover {
  border-color: var(--brand-red);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.option-card.selected {
  background: var(--brand-light);
  border-color: var(--brand-red);
  box-shadow: 0 0 0 3px rgba(175, 45, 44, 0.1);
}

.option-card.selected::after {
  content: '✓';
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 28px;
  height: 28px;
  background: var(--brand-red);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  animation: scaleIn 0.3s ease-out;
}

.option-card h4 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--grey-900);
  margin-bottom: 0.5rem;
}

.option-card p {
  font-size: 0.95rem;
  color: var(--grey-500);
}

.option-card svg {
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
  color: var(--brand-red);
}

/* Step Actions */
.step-actions {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: auto;
  padding-top: 2rem;
}

.btn {
  padding: 1rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition-base);
  font-family: 'Montserrat', sans-serif;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 120px;
  justify-content: center;
}

.btn.primary {
  background: var(--brand-red);
  color: white;
  box-shadow: var(--shadow-md);
}

.btn.primary:hover:not(:disabled) {
  background: var(--brand-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn.outline {
  background: white;
  color: var(--grey-700);
  border: 2px solid var(--grey-200);
}

.btn.outline:hover:not(:disabled) {
  background: var(--grey-50);
  border-color: var(--grey-300);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn svg {
  width: 20px;
  height: 20px;
}

/* Summary Step */
.summary {
  background: var(--grey-50);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.summary-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.summary-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--grey-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.summary-value {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--grey-900);
}

/* Thank You Modal */
#thankyou-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 1rem;
  animation: fadeIn 0.3s ease-out;
}

#thankyou-modal[hidden] {
  display: none;
}

.ty-modal-dialog {
  background: white;
  border-radius: var(--radius-xl);
  padding: 3rem;
  max-width: 500px;
  width: 100%;
  position: relative;
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.4s ease-out;
  text-align: center;
}

.ty-modal-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: transparent;
  border: none;
  font-size: 2rem;
  color: var(--grey-400);
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition-base);
}

.ty-modal-close:hover {
  background: var(--grey-100);
  color: var(--grey-700);
}

.ty-modal-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.5rem;
  background: var(--success-green);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: scaleIn 0.5s ease-out 0.2s both;
}

.ty-modal-icon svg {
  width: 40px;
  height: 40px;
  color: white;
}

.ty-modal-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--grey-900);
  margin-bottom: 1rem;
}

.ty-modal-body {
  font-size: 1.125rem;
  color: var(--grey-600);
  line-height: 1.6;
  margin-bottom: 2rem;
}

.ty-modal-body strong {
  color: var(--brand-red);
  font-weight: 600;
}

.ty-modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Loading State */
.form-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  border-radius: var(--radius-xl);
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--grey-200);
  border-top-color: var(--brand-red);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOutLeft {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(-50px);
  }
}

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

@keyframes scaleIn {
  from {
    transform: scale(0);
  }
  to {
    transform: scale(1);
  }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive Design */

/* Accessibility */
.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 Visible */
*:focus-visible {
  outline: 2px solid var(--brand-red);
  outline-offset: 2px;
}

/* Form Validation States */
.field-group.error input {
  border-color: #ef4444;
}

.field-group.error label {
  color: #ef4444;
}

.field-error {
  font-size: 0.875rem;
  color: #ef4444;
  margin-top: 0.5rem;
}

.field-group.success input {
  border-color: var(--success-green);
}

.field-group.success label {
  color: var(--success-green);
}