/* ============================================================
   FormCss.html
   Thiết kế form theo phong cách chuyên nghiệp K-ANH Inc.
   Responsive, mobile-friendly, hỗ trợ multi-step wizard.
   ============================================================ */

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary     : #1a73e8;
  --primary-dark: #1557b0;
  --success     : #0f9d58;
  --error       : #d93025;
  --warning     : #f9ab00;
  --bg          : #f8f9fa;
  --surface     : #ffffff;
  --border      : #dadce0;
  --text-main   : #202124;
  --text-sub    : #5f6368;
  --text-light  : #80868b;
  --radius      : 8px;
  --shadow      : 0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.24);
  --shadow-lg   : 0 4px 12px rgba(0,0,0,.15);
}

body {
  font-family: 'Segoe UI', 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Layout wrapper ──────────────────────────────────────── */
.form-wrapper {
  max-width: 780px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

/* ── Header ──────────────────────────────────────────────── */
.form-header {
  text-align: center;
  padding: 28px 0 20px;
}
.form-header .header-logo {
  display: block;
  width: 112px;
  height: 112px;
  object-fit: contain;
  margin: 0 auto 8px;
}
.form-header h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-main);
  margin: 6px 0 4px;
}
.form-header .subtitle {
  font-size: 13px;
  color: var(--text-sub);
}

@media (max-width: 480px) {
  .form-header .header-logo {
    width: 88px;
    height: 88px;
  }
}

/* ── Progress bar ────────────────────────────────────────── */
.progress-container {
  margin: 16px 0 24px;
}
.progress-steps {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}
.progress-steps::before {
  content: '';
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  height: 2px;
  background: var(--border);
  z-index: 0;
}
.progress-line {
  position: absolute;
  top: 16px;
  left: 16px;
  height: 2px;
  background: var(--primary);
  transition: width .4s ease;
  z-index: 1;
}
.step-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 2;
  cursor: default;
}
.step-dot .dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
  transition: all .3s;
}
.step-dot.active .dot {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.step-dot.completed .dot {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.step-dot .label {
  font-size: 11px;
  color: var(--text-light);
  white-space: nowrap;
  transition: color .3s;
}
.step-dot.active .label   { color: var(--primary); font-weight: 600; }
.step-dot.completed .label{ color: var(--success); }

/* ── Card (mỗi step) ─────────────────────────────────────── */
.form-card {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 28px 32px;
  margin-bottom: 16px;
  display: none;
}
.form-card.active { display: block; }
.form-card h2 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.form-card h2 .step-icon {
  width: 28px;
  height: 28px;
  background: #e8f0fe;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

/* ── Form grid ───────────────────────────────────────────── */
.form-row {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row.cols-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.form-row.cols-1-2 { grid-template-columns: 1fr 2fr; }
.form-row.cols-2-1 { grid-template-columns: 2fr 1fr; }

/* ── Field ───────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sub);
  letter-spacing: .3px;
}
.field label .required {
  color: var(--error);
  margin-left: 2px;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text-main);
  background: var(--surface);
  transition: border-color .2s, box-shadow .2s;
  outline: none;
  font-family: inherit;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,115,232,.15);
}
.field input.error,
.field select.error,
.field textarea.error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(217,48,37,.1);
}

/* Shared year/month control: [year] 年 [month] 月 */
.year-month-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.year-month-inputs input.year-input { flex: 2 1 0; min-width: 0; }
.year-month-inputs input.month-input { flex: 1 1 0; min-width: 0; }
.year-month-inputs .date-unit {
  flex: 0 0 auto;
  color: var(--text-sub);
  font-size: 13px;
}

.manual-entry-hint {
  margin-top: 2px;
  color: var(--text-light);
  font-size: 11px;
  font-style: italic;
  line-height: 1.45;
}

.demo-banner {
  margin-bottom: 14px;
  padding: 11px 14px;
  border: 1px solid #f4b400;
  border-radius: var(--radius);
  background: #fff8e1;
  color: #6b4f00;
  font-size: 12px;
  line-height: 1.5;
}

.consent-panel {
  margin-top: 20px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.consent-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  color: var(--text-sub);
  font-size: 13px;
  line-height: 1.5;
}
.consent-label input {
  width: 20px;
  min-width: 20px;
  height: 20px;
  min-height: 20px;
  margin-top: 1px;
  appearance: auto;
  accent-color: var(--primary);
}
.consent-label a { color: var(--primary); }
.turnstile-container { margin-top: 14px; min-height: 65px; }
.turnstile-container.demo-verification {
  min-height: 0;
  padding: 10px 12px;
  border-radius: 6px;
  background: #e6f4ea;
  color: #137333;
  font-size: 12px;
}
.consent-panel .field-error { color: var(--error); font-size: 11px; display: none; margin-top: 5px; }
.consent-panel .field-error.show { display: block; }
.field textarea { resize: vertical; min-height: 72px; }
.field select { cursor: pointer; }
.field .field-error {
  font-size: 11px;
  color: var(--error);
  display: none;
}
.field .field-error.show { display: block; }
.field .field-hint {
  font-size: 11px;
  color: var(--text-light);
}

/* ── Radio group ─────────────────────────────────────────── */
.radio-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.radio-btn {
  position: relative;
}
.radio-btn input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.radio-btn label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 16px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-sub);
  transition: all .2s;
  user-select: none;
  white-space: nowrap;
}
.radio-btn input[type="radio"]:checked + label {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.radio-btn label:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ── Toggle (有/無) ──────────────────────────────────────── */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.toggle-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sub);
  min-width: 80px;
}
.toggle-group {
  display: flex;
  gap: 0;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.toggle-group input[type="radio"] { display: none; }
.toggle-group label {
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-sub);
  transition: all .2s;
  border-right: 1px solid var(--border);
  user-select: none;
}
.toggle-group label:last-of-type { border-right: none; }
.toggle-group input[type="radio"]:checked + label {
  background: var(--primary);
  color: #fff;
}

/* ── Repeatable section (học vấn, kinh nghiệm, gia đình) ── */
.repeat-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.repeat-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  position: relative;
}
.repeat-item .item-number {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.btn-remove-item {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  font-size: 16px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all .2s;
}
.btn-remove-item:hover { background: #fce8e6; color: var(--error); }
.btn-add-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  background: none;
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  margin-top: 4px;
}
.btn-add-item:hover {
  border-color: var(--primary);
  background: #e8f0fe;
}

/* ── Conditional section (hiện/ẩn) ──────────────────────── */
.conditional-section {
  display: none;
  background: #e8f0fe;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 8px;
}
.conditional-section.show { display: block; }

/* ── Navigation buttons ──────────────────────────────────── */
.form-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 24px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .2s;
  font-family: inherit;
}
.btn-secondary {
  background: var(--surface);
  color: var(--text-sub);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-success {
  background: var(--success);
  color: #fff;
  font-size: 15px;
  padding: 12px 32px;
}
.btn-success:hover { background: #0b7a45; }
.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* ── Toast notifications ─────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 16px;
  border-radius: var(--radius);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  max-width: 320px;
  animation: slideIn .3s ease;
}
.toast.error   { background: var(--error); }
.toast.success { background: var(--success); }
.toast.warning { background: var(--warning); color: #333; }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── Validation summary ──────────────────────────────────── */
.validation-summary {
  background: #fce8e6;
  border: 1px solid var(--error);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  display: none;
}
.validation-summary.show { display: block; }
.validation-summary h4 {
  color: var(--error);
  font-size: 13px;
  margin-bottom: 8px;
}
.validation-summary ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.validation-summary li {
  font-size: 12px;
  color: var(--error);
  padding-left: 12px;
  position: relative;
}
.validation-summary li::before {
  content: '•';
  position: absolute;
  left: 0;
}

/* ── Success screen ──────────────────────────────────────── */
.success-screen {
  display: none;
  text-align: center;
  padding: 48px 32px;
}
.success-screen.show { display: block; }
.success-icon {
  width: 72px;
  height: 72px;
  background: #e6f4ea;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin: 0 auto 20px;
}
.success-screen h2 { font-size: 22px; margin-bottom: 8px; }
.success-screen p  { color: var(--text-sub); margin-bottom: 20px; }
/* ── Loading overlay ─────────────────────────────────────── */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,.85);
  z-index: 9998;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.loading-overlay.show { display: flex; }
.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 14px; color: var(--text-sub); font-weight: 500; }

/* ── Divider ─────────────────────────────────────────────── */
.section-divider {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin: 16px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 600px) {
  .form-card { padding: 20px 16px; }
  .form-row.cols-2,
  .form-row.cols-3,
  .form-row.cols-4,
  .form-row.cols-1-2,
  .form-row.cols-2-1 { grid-template-columns: 1fr; }
  .step-dot .label { display: none; }
  .form-nav { gap: 8px; }
  .btn { padding: 10px 16px; font-size: 13px; }
}

/* ── Cert blocks (Step 5) ────────────────────────────────── */
.cert-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.cert-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  min-width: 120px;
}
.cert-sub {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-light);
  margin-left: 6px;
}
.cert-block .conditional-section {
  margin-top: 10px;
  background: #f8f9fa;
}

/* ── Photo upload (Step 1) ───────────────────────────────── */
.photo-upload-area {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.photo-dropzone {
  width: 120px;
  height: 150px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--bg);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.photo-dropzone:hover {
  border-color: var(--primary);
  background: #e8f0fe;
}
.photo-dropzone.has-photo {
  border-style: solid;
  border-color: var(--success);
}
.photo-dropzone img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
  position: absolute;
  inset: 0;
}
.photo-dropzone .photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px;
  text-align: center;
  pointer-events: none;
}
.photo-dropzone .photo-placeholder .icon {
  font-size: 28px;
  line-height: 1;
}
.photo-dropzone .photo-placeholder .text {
  font-size: 11px;
  color: var(--text-light);
  font-weight: 500;
}
.photo-dropzone.has-photo .photo-placeholder {
  display: none;
}
.photo-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,.55);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 12px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.photo-dropzone.has-photo .photo-remove {
  display: flex;
}
.photo-instructions {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.photo-instructions .title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}
.photo-instructions ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.photo-instructions li {
  font-size: 12px;
  color: var(--text-sub);
  padding-left: 14px;
  position: relative;
}
.photo-instructions li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--success);
  font-weight: 700;
}
.photo-instructions li.bad::before { content: '✗'; color: var(--error); }
.photo-size-info {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 4px;
}
#photoInput { display: none; }

/* Fix select dropdown scroll trong cert-block */
.cert-block select,
.cert-block .conditional-section select {
  max-width: 100%;
  overflow: hidden;
}
/* Đảm bảo native select scroll hoạt động */
select option {
  white-space: normal;
}

/* ============================================================
   NATIVE APP FEEL — Mobile optimizations
   ============================================================ */

/* ── Tắt browser UI behaviors ────────────────────────────── */
* {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: manipulation;       /* tắt double-tap zoom */
}
input, select, textarea, button {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* ── Body: tắt bounce scroll trên iOS ───────────────────── */
html {
  height: -webkit-fill-available;
  overflow-x: hidden;
}
body {
  min-height: 100vh;
  min-height: -webkit-fill-available;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
}

/* ── Input/Select — min 48px để dễ tap, font 16px tránh iOS zoom ── */
.field input,
.field select,
.field textarea {
  min-height: 48px;
  font-size: 16px !important;   /* iOS tự zoom khi font < 16px */
  border-radius: 10px;
  padding: 12px 14px;
}
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235f6368' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}
.field textarea {
  min-height: 88px;
}

/* ── Buttons — full width trên mobile, đủ to để tap ─────── */
@media (max-width: 480px) {
  .btn {
    min-height: 52px;
    font-size: 15px;
    border-radius: 12px;
    padding: 14px 20px;
  }
  .btn-success {
    width: 100%;
    justify-content: center;
  }
  .form-nav {
    flex-direction: column-reverse;
    gap: 10px;
  }
  .form-nav .btn-primary,
  .form-nav .btn-secondary {
    width: 100%;
    justify-content: center;
  }
}

/* ── Step transition — mượt như native ──────────────────── */
.form-card {
  animation: none;
  transition: opacity 0.2s ease;
}
.form-card.active {
  animation: fadeSlideIn 0.25s ease forwards;
}
@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Progress dots — lớn hơn trên mobile ────────────────── */
@media (max-width: 480px) {
  .step-dot .dot {
    width: 36px;
    height: 36px;
    font-size: 13px;
  }
  .step-dot .label {
    font-size: 10px;
  }
  .form-wrapper {
    padding: 12px 12px 80px;
  }
  .form-card {
    padding: 20px 16px;
    border-radius: 16px;
  }
  .form-header h1 {
    font-size: 20px;
  }
}

/* ── Radio & Toggle — lớn hơn để dễ tap ─────────────────── */
@media (max-width: 480px) {
  .radio-btn label {
    min-height: 44px;
    padding: 10px 18px;
    font-size: 14px;
  }
  .toggle-group label {
    min-height: 44px;
    padding: 10px 16px;
    font-size: 14px;
  }
  .toggle-row {
    flex-wrap: wrap;
    gap: 8px;
  }
  .toggle-label {
    min-width: 100%;
    font-size: 13px;
    font-weight: 600;
  }
}

/* ── Repeat items — padding thoải mái hơn ───────────────── */
@media (max-width: 480px) {
  .repeat-item {
    padding: 16px 14px;
    border-radius: 12px;
  }
  .btn-add-item {
    width: 100%;
    justify-content: center;
    min-height: 48px;
    font-size: 14px;
  }
  .btn-remove-item {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
}

/* ── Cert blocks ─────────────────────────────────────────── */
@media (max-width: 480px) {
  .cert-block {
    padding: 14px 14px;
  }
  .cert-name {
    font-size: 13px;
  }
}

/* ── Photo dropzone — nhỏ gọn hơn trên mobile ───────────── */
@media (max-width: 480px) {
  .photo-upload-area {
    flex-direction: column;
    align-items: center;
  }
  .photo-dropzone {
    width: 100px;
    height: 130px;
  }
  .photo-instructions {
    width: 100%;
  }
}

/* ── Toast — full width bottom trên mobile ──────────────── */
@media (max-width: 480px) {
  .toast-container {
    bottom: 0;
    right: 0;
    left: 0;
    padding: 0 0 env(safe-area-inset-bottom);
  }
  .toast {
    border-radius: 0;
    max-width: 100%;
    padding: 16px 20px;
    font-size: 14px;
  }
}

/* ── Loading overlay ─────────────────────────────────────── */
@media (max-width: 480px) {
  .loading-text {
    font-size: 15px;
  }
  .spinner {
    width: 48px;
    height: 48px;
    border-width: 4px;
  }
}

/* ── Safe area padding (iPhone notch) ───────────────────── */
.final-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.btn-preview { background: #e8f0fe; color: #174ea6; border: 1.5px solid #aecbfa; }
.btn-preview:hover { background: #d2e3fc; }
.btn-download { background: #fff4e5; color: #a45100; border: 1.5px solid #f6c26b; }
.btn-download:hover { background: #fde7c3; }
@media (max-width: 480px) {
  .final-actions { width: 100%; display: grid; grid-template-columns: 1fr; }
  .final-actions .btn { width: 100%; justify-content: center; }
}
.preview-modal { display:none; position:fixed; inset:0; z-index:10000; background:rgba(18,32,55,.72); padding:18px; }
.preview-modal.show { display:flex; align-items:center; justify-content:center; }
.preview-panel { width:min(980px,100%); height:min(92vh,920px); background:#fff; border-radius:14px; overflow:hidden; box-shadow:0 24px 80px rgba(0,0,0,.35); display:flex; flex-direction:column; }
.preview-header { min-height:60px; padding:10px 16px; background:#16325c; color:#fff; display:flex; align-items:center; justify-content:space-between; gap:12px; }
.preview-actions { display:flex; align-items:center; gap:8px; }
.preview-actions .btn { padding:8px 12px; }
.preview-close { width:38px; height:38px; border:0; border-radius:50%; background:#ffffff22; color:#fff; font-size:18px; cursor:pointer; }
.preview-panel iframe { flex:1; width:100%; border:0; background:#eef3f8; }

.form-wrapper {
  padding-bottom: max(60px, env(safe-area-inset-bottom));
}
.form-nav {
  padding-bottom: env(safe-area-inset-bottom);
}

/* ── Keyboard: tránh layout bị đẩy trên iOS ─────────────── */
@supports (-webkit-touch-callout: none) {
  .form-card {
    padding-bottom: 20px;
  }
}

/* ── Focus state rõ hơn trên mobile ─────────────────────── */
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,115,232,.2);
  outline: none;
}

/* ── Section divider nhỏ gọn hơn ────────────────────────── */
@media (max-width: 480px) {
  .section-divider {
    font-size: 11px;
    margin: 14px 0 8px;
  }
  .field-hint {
    font-size: 12px;
  }
  .field label {
    font-size: 13px;
  }
  .final-actions { width:100%; }
  .final-actions .btn { flex:1; }
  .preview-modal { padding:0; }
  .preview-panel { height:100vh; border-radius:0; }
}
