/* ══════════════════════════════════════════
   THAMDINH WIZARD – CSS
   Self-contained modal + wizard styles
══════════════════════════════════════════ */

/* ── Modal Base (self-contained) ── */
.td-modal {
  position: fixed; inset: 0; z-index: 9999;
  display: none; align-items: center; justify-content: center;
  padding: 24px;
}
.td-modal.open { display: flex; }
.td-modal__overlay {
  position: absolute; inset: 0; background: rgba(10,21,35,.7);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  animation: tdFadeIn .25s ease;
}
.td-modal__box {
  position: relative; z-index: 2;
  background: #fff; border-radius: 16px;
  width: 100%; max-width: 580px; max-height: 90vh;
  overflow-y: auto; box-shadow: 0 24px 80px rgba(0,0,0,.25);
  padding: 40px; animation: tdSlideUp .35s cubic-bezier(.22,1,.36,1);
}
.td-modal__close {
  position: absolute; top: 16px; right: 16px; z-index: 3;
  width: 36px; height: 36px; border-radius: 50%;
  background: #eef1f4; border: none; cursor: pointer;
  font-size: 22px; color: #666; display: flex; align-items: center; justify-content: center;
  transition: background .2s, color .2s;
}
.td-modal__close:hover { background: #e2e8f0; color: #1a1a1a; }
.td-modal__header { text-align: center; margin-bottom: 28px; }
.td-modal__icon {
  width: 56px; height: 56px; border-radius: 14px;
  background: rgba(200,167,94,.08); border: 1px solid rgba(200,167,94,.15);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
}
.td-modal__icon svg { width: 26px; height: 26px; }
.td-modal__header h2 {
  font-size: 24px; font-weight: 600;
  color: #0f1c2e; margin-bottom: 8px;
}
.td-modal__subtitle { font-size: 15px; color: #666; }
.td-modal__package {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; margin-bottom: 24px;
  background: rgba(200,167,94,.06); border: 1px solid rgba(200,167,94,.15);
  border-radius: 8px;
}
.td-modal__package-label { font-size: 13px; color: #666; }
.td-modal__package-name { font-size: 15px; font-weight: 600; color: #0f1c2e; }

/* ── Form Fields ── */
.td-form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.td-form__field { margin-bottom: 18px; }
.td-form__field label {
  display: block; font-size: 14px; font-weight: 600; color: #0f1c2e;
  margin-bottom: 6px;
}
.td-form__field .req { color: #dc2626; }
.td-form__hint { font-weight: 400; color: #888; font-size: 12px; }

.td-form__field input[type="text"],
.td-form__field input[type="tel"],
.td-form__field input[type="email"],
.td-form__field input[type="url"],
.td-form__field input[type="number"],
.td-form__field input[type="date"],
.td-form__field select,
.td-form__field textarea {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid #d1d5db; border-radius: 8px;
  font-size: 15px; color: #1a1a1a;
  background: #fff; transition: border-color .2s, box-shadow .2s;
  outline: none; box-sizing: border-box;
}
.td-form__field input:focus,
.td-form__field select:focus,
.td-form__field textarea:focus {
  border-color: #c8a75e; box-shadow: 0 0 0 3px rgba(200,167,94,.12);
}
.td-form__field input.td-error,
.td-form__field select.td-error,
.td-form__field textarea.td-error {
  border-color: #dc2626; box-shadow: 0 0 0 3px rgba(220,38,38,.08);
}
.td-form__field textarea { resize: vertical; min-height: 80px; }
.td-form__field select {
  cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%23666' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 12px;
  padding-right: 40px;
}

/* Captcha */
.td-form__captcha { margin-bottom: 16px; }
.td-form__captcha label {
  display: block; font-size: 14px; font-weight: 500;
  color: #1a1a1a; margin-bottom: 6px;
}
.td-captcha-row {
  display: flex; align-items: center; gap: 12px;
  background: rgba(200,167,94,.08); border: 1px solid rgba(200,167,94,.2);
  border-radius: 8px; padding: 10px 14px;
}
.td-captcha-question {
  display: flex; align-items: center; gap: 8px;
  font-size: 16px; font-weight: 600; color: #0f1c2e;
  white-space: nowrap; flex-shrink: 0;
}
.td-captcha-input {
  width: 64px; height: 40px; text-align: center;
  font-size: 18px; font-weight: 700; color: #0f1c2e;
  border: 2px solid #d1d5db; border-radius: 8px;
  background: #fff; outline: none;
  -moz-appearance: textfield;
}
.td-captcha-input::-webkit-outer-spin-button,
.td-captcha-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.td-captcha-input:focus { border-color: #c8a75e; box-shadow: 0 0 0 3px rgba(200,167,94,.15); }
.td-captcha-input.td-error { border-color: #dc2626; box-shadow: 0 0 0 3px rgba(220,38,38,.1); }

/* Submit & messages */
.td-form__actions { margin-top: 8px; }
.td-form__submit-loading { display: inline-flex; align-items: center; gap: 8px; }
@keyframes tdSpin { to { transform: rotate(360deg); } }
.td-spinner { width: 18px; height: 18px; animation: tdSpin .8s linear infinite; }

.td-form__message {
  margin-top: 16px; padding: 0; border-radius: 8px;
  font-size: 14px; line-height: 1.5; text-align: center;
  display: none;
}
.td-form__message.td-msg-success {
  display: block; padding: 16px;
  background: rgba(34,197,94,.06); border: 1px solid rgba(34,197,94,.15);
  color: #166534;
}
.td-form__message.td-msg-error {
  display: block; padding: 16px;
  background: rgba(220,38,38,.04); border: 1px solid rgba(220,38,38,.12);
  color: #991b1b;
}
.td-form.td-submitted .td-form__field,
.td-form.td-submitted .td-form__row,
.td-form.td-submitted .td-form__actions,
.td-form.td-submitted .td-modal__package,
.td-form.td-submitted .td-form__captcha,
.td-form.td-submitted .wizard-checkbox--terms { display: none; }

/* Buttons for wizard */
.wizard-nav .btn-primary {
  display: inline-block; background: #c8a75e; color: #0f1c2e;
  font-weight: 600; font-size: 15px;
  padding: 14px 36px; border-radius: 6px; border: none; cursor: pointer;
  text-decoration: none; transition: all .3s;
}
.wizard-nav .btn-primary:hover { background: #d4b76e; transform: translateY(-1px); }
.wizard-nav .btn-outline--dark {
  display: inline-block; background: transparent; color: #0f1c2e;
  font-weight: 600; font-size: 15px;
  padding: 12px 28px; border-radius: 6px; border: 1.5px solid #0f1c2e;
  cursor: pointer; text-decoration: none; transition: all .3s;
}
.wizard-nav .btn-outline--dark:hover { background: #0f1c2e; color: #fff; }

@keyframes tdFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes tdSlideUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }

/* ── Wizard Modal Box ── */
.td-modal__box--wizard {
  max-width: 680px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 36px 40px;
}

/* ── Progress Bar ── */
.wizard-progress {
  margin-bottom: 28px;
  position: relative;
}

.wizard-progress__track {
  position: absolute;
  top: 18px;
  left: 40px;
  right: 40px;
  height: 3px;
  background: #e5e7eb;
  border-radius: 2px;
  z-index: 0;
}

.wizard-progress__fill {
  height: 100%;
  background: var(--champagne, #c8a75e);
  border-radius: 2px;
  transition: width .4s cubic-bezier(.22,1,.36,1);
  width: 0%;
}

.wizard-progress__steps {
  display: flex;
  justify-content: space-between;
  position: relative;
  z-index: 1;
}

.wizard-progress__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.wizard-progress__circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e5e7eb;
  color: #999;
  font-family: var(--font-heading, 'Playfair Display', serif);
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .3s;
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px #e5e7eb;
}

.wizard-progress__step.active .wizard-progress__circle,
.wizard-progress__step.completed .wizard-progress__circle {
  background: var(--champagne, #c8a75e);
  color: var(--navy, #0f1c2e);
  box-shadow: 0 0 0 1px var(--champagne, #c8a75e);
}

.wizard-progress__step.completed .wizard-progress__circle {
  background: var(--navy, #0f1c2e);
  color: var(--champagne, #c8a75e);
  box-shadow: 0 0 0 1px var(--navy, #0f1c2e);
}

.wizard-progress__label {
  font-size: 12px;
  font-weight: 500;
  color: #999;
  margin-top: 8px;
  text-align: center;
  transition: color .3s;
}

.wizard-progress__step.active .wizard-progress__label {
  color: var(--navy, #0f1c2e);
  font-weight: 600;
}

.wizard-progress__step.completed .wizard-progress__label {
  color: var(--navy, #0f1c2e);
}

/* ── Step Content ── */
.wizard-step {
  display: none;
  animation: wzFadeIn .35s ease;
}

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

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

.wizard-step__title {
  font-family: var(--font-heading, 'Playfair Display', serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--navy, #0f1c2e);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f0f0f0;
}

/* ── Upload Grid ── */
.wizard-upload-section {
  margin-top: 8px;
}

.wizard-upload-section__label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--navy, #0f1c2e);
  margin-bottom: 8px;
}

.wizard-upload-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.wizard-upload-zone {
  position: relative;
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wizard-upload-zone:hover {
  border-color: var(--champagne, #c8a75e);
  background: rgba(200,167,94,.02);
}

.wizard-upload-zone.has-file {
  border-style: solid;
  border-color: var(--champagne, #c8a75e);
  background: rgba(200,167,94,.04);
}

.wizard-upload-zone--multi {
  grid-column: 1 / -1;
  min-height: 80px;
}

.wizard-upload-zone__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}

.wizard-upload-zone__inner svg {
  width: 22px;
  height: 22px;
  color: #aaa;
}

.wizard-upload-zone__inner span {
  font-size: 11px;
  color: #888;
  line-height: 1.3;
}

.wizard-upload-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* Preview thumbnails */
.wizard-upload-zone__preview {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
}

.wizard-upload-zone.has-file .wizard-upload-zone__inner {
  display: none;
}

.wizard-upload-zone.has-file .wizard-upload-zone__preview {
  display: flex;
}

.wizard-preview-item {
  position: relative;
  display: inline-block;
}

.wizard-preview-item img {
  width: 64px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #ddd;
}

.wizard-preview-item__pdf {
  width: 64px;
  height: 48px;
  background: #f1f5f9;
  border-radius: 4px;
  border: 1px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #3b82f6;
}

.wizard-preview-item__remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  background: #dc2626;
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

/* ── Radio & Checkbox Groups ── */
.wizard-radio-group {
  display: flex;
  gap: 16px;
}

.wizard-radio {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 15px;
  color: var(--text-main, #1a1a1a);
}

.wizard-radio input {
  accent-color: var(--champagne, #c8a75e);
  width: 18px;
  height: 18px;
}

.wizard-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wizard-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-main, #1a1a1a);
  background: #f8f9fa;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  transition: all .2s;
}

.wizard-checkbox:hover {
  border-color: var(--champagne, #c8a75e);
  background: rgba(200,167,94,.04);
}

.wizard-checkbox input {
  accent-color: var(--champagne, #c8a75e);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.wizard-checkbox input:checked + span {
  color: var(--navy, #0f1c2e);
  font-weight: 500;
}

.wizard-checkbox--terms {
  background: transparent;
  border: none;
  padding: 0;
  font-size: 13px;
  color: #666;
}

.wizard-checkbox--terms a {
  color: var(--champagne, #c8a75e);
  text-decoration: underline;
}

/* ── Family Members ── */
.wizard-member {
  background: #f8f9fa;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  animation: wzFadeIn .3s ease;
}

.wizard-member__header {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy, #0f1c2e);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wizard-member__header::before {
  content: '';
  width: 4px;
  height: 16px;
  background: var(--champagne, #c8a75e);
  border-radius: 2px;
}

.wizard-member__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.wizard-member__grid .td-form__field {
  margin-bottom: 0;
}

.wizard-member__grid label {
  font-size: 13px;
}

.wizard-member__grid input,
.wizard-member__grid select {
  padding: 9px 12px;
  font-size: 14px;
}

/* ── Navigation ── */
.wizard-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #f0f0f0;
  gap: 12px;
}

.wizard-nav__prev {
  padding: 12px 28px;
  font-size: 15px;
}

.wizard-nav__next,
.wizard-nav__submit {
  margin-left: auto;
  padding: 14px 36px;
  font-size: 15px;
}

/* ── Sidebar: Recent Hồ sơ ── */
.recent-hoso {
  background: var(--gray-warm, #f3f1ed);
  padding: 80px 0;
}

.recent-hoso__list {
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.recent-hoso__item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--white, #fff);
  border-radius: var(--radius, 12px);
  box-shadow: var(--shadow-sm, 0 2px 12px rgba(0,0,0,.06));
  transition: transform .2s, box-shadow .2s;
  cursor: default;
}

.recent-hoso__item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md, 0 4px 24px rgba(0,0,0,.10));
}

.recent-hoso__icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(200,167,94,.08);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.recent-hoso__icon svg {
  width: 20px;
  height: 20px;
}

.recent-hoso__info {
  flex: 1;
  min-width: 0;
}

.recent-hoso__name {
  font-size: 15px;
  font-weight: 600;
  color: var(--navy, #0f1c2e);
}

.recent-hoso__province {
  font-weight: 400;
  color: #888;
  font-size: 13px;
}

.recent-hoso__meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 4px;
}

.recent-hoso__date {
  font-size: 13px;
  color: #888;
}

.recent-hoso__views {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: #aaa;
}

.recent-hoso__views svg {
  flex-shrink: 0;
}

/* ══════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════ */
@media (max-width: 768px) {
  .td-modal__box--wizard {
    padding: 24px 18px;
    max-width: 100%;
  }

  .wizard-progress__label {
    display: none;
  }

  .wizard-progress__circle {
    width: 30px;
    height: 30px;
    font-size: 13px;
  }

  .wizard-progress__track {
    top: 14px;
    left: 30px;
    right: 30px;
  }

  .wizard-upload-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .wizard-member__grid {
    grid-template-columns: 1fr;
  }

  .wizard-nav__prev {
    padding: 10px 20px;
    font-size: 14px;
  }

  .wizard-nav__next,
  .wizard-nav__submit {
    padding: 12px 28px;
    font-size: 14px;
  }

  .wizard-step__title {
    font-size: 18px;
  }

  .wizard-checkbox {
    font-size: 13px;
    padding: 6px 10px;
  }
}

@media (max-width: 480px) {
  .wizard-upload-grid {
    grid-template-columns: 1fr 1fr;
  }

  .td-form__row {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

/* ── Mobile: Hồ sơ đăng ký block ──
   Ẩn trên desktop (khi sidebar phải hiện),
   hiện trên tablet/mobile khi sidebar phải bị ẩn */
.wizard-mobile-hoso {
  display: none;
}
@media (max-width: 860px) {
  .wizard-mobile-hoso {
    display: block;
  }
}
