:root {
  --primary-color: #0f172a;        /* Slate dark */
  --accent-color: #0284c7;         /* Medical Teal/Blue */
  --accent-light: #f0f9ff;        /* Soft active bg */
  --accent-border: #38bdf8;       /* Active border */
  --success-color: #059669;       /* Green confirm */
  --bg-color: #f8fafc;            /* Clean light grey */
  --card-bg: #ffffff;             /* Crisp white card */
  --text-main: #1e293b;           /* High contrast text */
  --text-muted: #64748b;          /* Secondary text */
  --border-color: #cbd5e1;        /* Subtle divider */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
}

.app-wrapper {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: var(--bg-color);
  position: relative;
}

/* Header & Progress Bar */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #e2e8f0;
  padding: 12px 20px;
}

.brand-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-icon {
  width: 16px;
  height: 16px;
  fill: var(--accent-color);
}

.progress-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.progress-bar-bg {
  flex: 1;
  height: 8px;
  background-color: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0284c7, #0d9488);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.step-badge {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-color);
  background-color: var(--accent-light);
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Zone de contenu dynamique */
.app-content {
  flex: 1;
  padding: 24px 20px 100px 20px;
  display: flex;
  flex-direction: column;
}

.screen {
  display: none;
  animation: fadeIn 0.25s ease-in-out forwards;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

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

.section-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: var(--accent-color);
  background-color: var(--accent-light);
  padding: 4px 12px;
  border-radius: 6px;
  margin-bottom: 16px;
  align-self: flex-start;
  text-transform: uppercase;
}

.screen-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-color);
  line-height: 1.35;
  margin-bottom: 12px;
}

.screen-description {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.6;
}

.duration-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: #f1f5f9;
  border-left: 3px solid var(--accent-color);
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 14px;
  color: #334155;
  font-weight: 500;
  margin-top: 10px;
  margin-bottom: 24px;
}

/* Groupes de Questions */
.question-group {
  margin-bottom: 28px;
}

.question-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 12px;
  line-height: 1.4;
}

.sub-label {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  display: inline;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Cards de Choix */
.option-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background-color: var(--card-bg);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
  user-select: none;
  touch-action: manipulation;
}

.option-card:active {
  transform: scale(0.985);
}

.option-card.selected {
  border-color: var(--accent-color);
  background-color: var(--accent-light);
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.12);
}

.choice-indicator {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border: 2px solid #94a3b8;
  border-radius: 6px;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #fff;
  transition: all 0.15s ease;
}

.option-card.radio .choice-indicator {
  border-radius: 50%;
}

.option-card.selected .choice-indicator {
  border-color: var(--accent-color);
  background-color: var(--accent-color);
}

.choice-indicator::after {
  content: "";
  display: none;
}

.option-card.checkbox.selected .choice-indicator::after {
  display: block;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

.option-card.radio.selected .choice-indicator::after {
  display: block;
  width: 8px;
  height: 8px;
  background-color: white;
  border-radius: 50%;
}

.option-label {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-main);
  flex: 1;
  line-height: 1.4;
}

/* Inputs Texte / Textarea */
.text-input-container {
  margin-top: 10px;
  display: none;
  animation: fadeIn 0.2s ease;
}

.custom-input, .custom-textarea {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  font-family: inherit;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: #ffffff;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s ease;
}

.custom-input:focus, .custom-textarea:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

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

.privacy-disclaimer {
  background-color: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  margin-top: 20px;
  line-height: 1.5;
}

.validation-warning {
  display: none;
  background-color: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  margin-top: 16px;
  align-items: center;
  gap: 8px;
}

.validation-warning.visible {
  display: flex;
}

/* Sticky Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: #ffffff;
  border-top: 1px solid #e2e8f0;
  padding: 14px 20px;
  z-index: 100;
  box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.05);
}

.bottom-nav-inner {
  max-width: 620px;
  margin: 0 auto;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 24px;
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 52px;
  touch-action: manipulation;
}

.btn-secondary {
  background-color: #f1f5f9;
  color: #475569;
  flex: 1;
  max-width: 140px;
}

.btn-secondary:hover {
  background-color: #e2e8f0;
}

.btn-primary {
  background-color: var(--accent-color);
  color: #ffffff;
  flex: 2;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}

.btn-primary:hover {
  background-color: #0369a1;
}

.btn-primary:active, .btn-secondary:active {
  transform: scale(0.98);
}

.btn-full {
  width: 100%;
  flex: 1;
}

.thank-you-card {
  text-align: center;
  padding: 40px 20px;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  margin-top: 20px;
}

.thank-you-icon {
  width: 72px;
  height: 72px;
  background-color: #dcfce7;
  color: var(--success-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px auto;
}

.thank-you-icon svg {
  width: 40px;
  height: 40px;
  stroke: var(--success-color);
}

@media (min-width: 640px) {
  .app-wrapper {
    margin-top: 30px;
    margin-bottom: 40px;
    min-height: calc(100vh - 70px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 1px solid #e2e8f0;
  }
  
  .bottom-nav {
    position: absolute;
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
  }
}
