/*
 * Preconsulta del paciente — CSS compartido
 * Usado por: 17a, 17b, 17c, 17d, 17e
 */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Top bar — doctor info */
.doctor-bar {
  width: 100%;
  background: var(--primary-dark);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.doctor-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--white);
  flex-shrink: 0;
}
.doctor-info {
  flex: 1;
}
.doctor-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--white);
}
.doctor-specialty {
  font-size: 0.75rem;
  color: var(--primary-accent);
}
.appt-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--primary-dark);
  background: var(--primary-accent);
  padding: 0.25rem 0.625rem;
  border-radius: 4px;
  white-space: nowrap;
}

/* Main */
.main {
  width: 100%;
  max-width: 540px;
  padding: 2rem 1.5rem 3rem;
  flex: 1;
}

/* Progress */
.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--primary-pale);
  border-radius: 2px;
  margin-bottom: 2rem;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.3s ease;
}
.step-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}
.section-title {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 0.375rem;
  letter-spacing: -0.01em;
}
.section-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  line-height: 1.5;
}

/* Form fields */
.form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
.field-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
}
.field-label .required {
  color: var(--error);
}
.field-label .optional {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.75rem;
}
.field-hint {
  font-size: 0.6875rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: var(--font);
  font-size: 0.9375rem;
  color: var(--text-primary);
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  outline: none;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}
.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(123, 79, 162, 0.08);
}
.input::placeholder {
  color: var(--text-muted);
  font-weight: 300;
}
select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8a9a' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}
textarea.input {
  resize: vertical;
  min-height: 80px;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Checkbox */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.checkbox-item {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  cursor: pointer;
  padding: 0.625rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}
.checkbox-item:hover {
  border-color: var(--primary-accent);
  background: var(--primary-ghost);
}
.checkbox-item.selected {
  border-color: var(--primary);
  background: var(--primary-pale);
}
.checkbox-box {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  color: transparent;
  transition: all 0.15s ease;
}
.checkbox-item.selected .checkbox-box {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
}
.checkbox-text {
  font-size: 0.8125rem;
  color: var(--text-primary);
  line-height: 1.4;
}
.checkbox-text small {
  display: block;
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

/* Alert box */
.alert-box {
  padding: 0.875rem 1rem;
  border-radius: 6px;
  font-size: 0.8125rem;
  line-height: 1.5;
  display: flex;
  gap: 0.625rem;
  align-items: flex-start;
}
.alert-box.info {
  background: var(--primary-pale);
  color: var(--primary-dark);
  border: 1px solid var(--primary-accent);
}
.alert-box.warning {
  background: var(--warning-bg);
  color: #6b5300;
  border: 1px solid var(--warning-border);
}
.alert-box svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Consent card */
.consent-card {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.consent-header {
  padding: 0.875rem 1rem;
  background: var(--primary-ghost);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.consent-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary-dark);
}
.consent-required {
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--error);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.consent-body {
  padding: 1rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-height: 120px;
  overflow-y: auto;
}
.consent-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 0.625rem;
}
.consent-check {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.consent-check.checked {
  background: var(--success);
  border-color: var(--success);
  color: var(--white);
  font-size: 0.75rem;
}
.consent-label {
  font-size: 0.8125rem;
  color: var(--text-primary);
  cursor: pointer;
}

/* Signature pad */
.signature-pad {
  width: 100%;
  height: 120px;
  border: 1.5px dashed var(--border);
  border-radius: 6px;
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: crosshair;
  position: relative;
}
.signature-pad .placeholder {
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-align: center;
}
.signature-pad .placeholder svg {
  display: block;
  margin: 0 auto 0.375rem;
  width: 24px;
  height: 24px;
}
.signature-pad.signed {
  border-style: solid;
  border-color: var(--success);
  background: var(--success-bg);
}
.signature-pad.signed .placeholder {
  color: var(--success);
  font-weight: 600;
}

/* Buttons */
.buttons {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}
.btn-primary {
  flex: 1;
  padding: 0.875rem 1.5rem;
  font-family: var(--font);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--white);
  background: var(--primary);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
  text-decoration: none;
  text-align: center;
}
.btn-primary:hover {
  background: var(--primary-light);
}
.btn-secondary {
  padding: 0.875rem 1.5rem;
  font-family: var(--font);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--primary);
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.15s ease;
  text-decoration: none;
  text-align: center;
}
.btn-secondary:hover {
  border-color: var(--primary);
}

/* Confirmation */
.confirm-card {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
}
.confirm-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--success-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  color: var(--success);
}
.confirm-icon svg {
  width: 28px;
  height: 28px;
}
.confirm-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 0.5rem;
}
.confirm-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.25rem;
}
.confirm-detail {
  background: var(--primary-pale);
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1.25rem;
}
.confirm-detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8125rem;
  padding: 0.375rem 0;
}
.confirm-detail-label {
  color: var(--text-muted);
}
.confirm-detail-value {
  color: var(--primary-dark);
  font-weight: 600;
}
.confirm-instructions {
  text-align: left;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1rem;
}
.confirm-instructions strong {
  color: var(--primary-dark);
}
.confirm-instructions ul {
  margin-top: 0.5rem;
  padding-left: 1.25rem;
}
.confirm-instructions li {
  margin-bottom: 0.25rem;
}

/* Index link */
.index-link {
  display: block;
  text-align: center;
  padding: 1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}
.index-link:hover {
  color: var(--primary-light);
}

/* Privacy badge */
.privacy-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.875rem;
  background: var(--primary-ghost);
  border-radius: 6px;
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}
.privacy-badge svg {
  width: 14px;
  height: 14px;
  color: var(--primary);
  flex-shrink: 0;
}

/* Footer */
.page-footer {
  width: 100%;
  max-width: 540px;
  padding: 1rem 1.5rem 2rem;
  text-align: center;
  font-size: 0.6875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Responsive */
@media (max-width: 540px) {
  .main {
    padding: 1.5rem 1rem 2.5rem;
  }
  .field-row {
    grid-template-columns: 1fr;
  }
  .buttons {
    flex-direction: column-reverse;
  }
  .btn-secondary {
    width: 100%;
    text-align: center;
  }
}
