/* ============================================================
   Thai Lion Air TQM — Mobile Components CSS
   Thumb-Friendly / Outdoor / Glove-Safe Design
   Minimum touch target: 64px height
   Tested for: sunlight readability, gloved fingers, fast taps
   ============================================================ */

/* BASE MOBILE BODY */
.mobile-body {
  background: var(--bg-primary);
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ============================================================
   MOBILE HEADER
   ============================================================ */
.mob-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-secondary);
  border-bottom: 3px solid var(--red);
  padding: .75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.mob-brand { display: flex; align-items: center; gap: .65rem; }
.mob-logo {
  width: 38px; height: 38px;
  background: var(--red);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 1rem; color: white;
  flex-shrink: 0;
  box-shadow: var(--shadow-red);
}
.mob-title { font-size: .95rem; font-weight: 800; }
.mob-sub   { font-size: .68rem; color: var(--text-muted); }
.mob-clock-wrap { text-align: right; flex-shrink: 0; }
.mob-clock { font-size: 1.05rem; font-weight: 800; font-family: 'Courier New', monospace; color: var(--red-light); }
.mob-clock-sub { font-size: .55rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }

/* ============================================================
   STEP PROGRESS BAR
   ============================================================ */
.step-bar {
  background: var(--bg-secondary);
  padding: .6rem 1rem .5rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 65px;
  z-index: 90;
}
.step-track {
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: .5rem;
}
.step-fill {
  height: 100%;
  background: var(--red);
  border-radius: 4px;
  transition: width .3s ease;
}
.step-labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: .25rem;
}
.step-dot {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--bg-card-alt);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: .65rem; font-weight: 700;
  color: var(--text-muted);
  transition: all .2s;
}
.step-dot.active {
  background: var(--red);
  border-color: var(--red);
  color: white;
  transform: scale(1.15);
}
.step-dot.done {
  background: var(--green);
  border-color: var(--green);
  color: white;
}
.step-name {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  text-align: center;
}

/* ============================================================
   STEP SCREENS
   ============================================================ */
.step-screen {
  display: none;
  padding: 1rem 1rem 1.5rem;
  animation: fadeSlide .2s ease;
  min-height: calc(100vh - 200px);
}
.step-screen.active { display: block; }
@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes bounce {
  0%,100% { transform: scale(1); }
  50%      { transform: scale(1.2); }
}

.step-hero { text-align: center; padding: 1rem 0 1.25rem; }
.step-icon { font-size: 2.8rem; margin-bottom: .4rem; }
.step-heading { font-size: 1.1rem; font-weight: 800; color: var(--text-primary); line-height: 1.3; margin-bottom: .3rem; }
.step-hint { font-size: .8rem; color: var(--text-muted); }

/* STEP FOOTER */
.step-footer {
  position: sticky;
  bottom: calc(64px + env(safe-area-inset-bottom));
  background: var(--bg-primary);
  padding: .75rem 0;
  margin-top: 1.5rem;
}
.step-footer-2 { display: flex; gap: .75rem; }

/* ============================================================
   BUTTONS — THUMB SIZE (min 64px)
   ============================================================ */
.mob-btn-next {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  background: var(--red);
  color: white;
  border: none;
  border-radius: 14px;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: .5px;
  box-shadow: var(--shadow-red);
  transition: background .15s, transform .1s;
  flex: 1;
  font-family: inherit;
}
.mob-btn-next:active { transform: scale(.97); background: var(--red-dark); }

.mob-btn-back {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  flex: 0 0 80px;
  text-decoration: none;
}
.mob-btn-back:active { background: var(--bg-hover); }

.mob-btn-submit {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  background: linear-gradient(135deg, var(--green), #15803d);
  color: white;
  border: none;
  border-radius: 16px;
  font-size: 1.15rem;
  font-weight: 900;
  cursor: pointer;
  letter-spacing: .5px;
  box-shadow: 0 4px 20px rgba(22,163,74,.35);
  transition: all .15s;
  font-family: inherit;
  flex: 1;
  text-decoration: none;
}
.mob-btn-submit:active { transform: scale(.97); }
.mob-btn-submit:disabled { background: var(--grey); box-shadow: none; }

/* ============================================================
   FLIGHT CARDS
   ============================================================ */
.flight-list {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  margin-bottom: 1rem;
}
.flight-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1rem;
  min-height: 70px;
  padding: .9rem 1rem;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  font-family: inherit;
  transition: all .15s;
}
.flight-card:active { transform: scale(.98); }
.flight-card.selected {
  border-color: var(--red);
  background: var(--red-bg);
  box-shadow: var(--shadow-red);
}
.fc-fn   { font-size: 1.2rem; font-weight: 900; font-family: 'Courier New', monospace; color: var(--text-primary); min-width: 60px; }
.fc-route{ font-size: .9rem;  font-weight: 700; color: var(--text-secondary); flex: 1; }
.fc-meta { font-size: .68rem; color: var(--text-muted); white-space: nowrap; }

.hourly-flight-board {
  display: grid;
  grid-template-columns: 1fr;
  gap: .75rem;
  margin: 0 0 1rem;
  padding: .25rem 0 .8rem;
}
.flight-hour-group {
  width: 100%;
  min-width: 0;
  padding: .7rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-secondary);
}
.flight-hour-group.current {
  border-color: var(--blue-light);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, .18);
}
.flight-hour-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .6rem;
  padding-bottom: .55rem;
  border-bottom: 1px solid var(--border);
}
.flight-hour-time {
  color: var(--blue-light);
  font: 900 1rem 'Courier New', monospace;
}
.flight-hour-count {
  padding: .18rem .45rem;
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: .65rem;
  font-weight: 800;
}
.flight-hour-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: .5rem;
}
.hourly-flight-board .flight-card {
  display: block;
  min-height: 0;
  margin: 0;
  padding: .7rem;
  border-width: 1px;
  border-radius: 10px;
}
.flight-card-top,
.flight-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}
.hourly-flight-board .fc-fn {
  min-width: 0;
  font-size: 1rem;
}
.flight-direction {
  padding: .16rem .38rem;
  border-radius: 5px;
  color: var(--blue-light);
  background: rgba(34, 211, 238, .1);
  font-size: .58rem;
  font-weight: 900;
}
.flight-direction.arr {
  color: var(--yellow-light);
  background: rgba(250, 204, 21, .1);
}
.hourly-flight-board .fc-route {
  margin: .35rem 0;
  font-size: .78rem;
}
.flight-card-bottom {
  color: var(--text-muted);
  font-size: .62rem;
}
.flight-hour-empty,
.flight-hour-error {
  width: 100%;
  padding: 1rem;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--text-muted);
  text-align: center;
}

@media (max-width: 520px) {
  .flight-hour-cards {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   STATUS BIG BUTTONS (Dept Status)
   ============================================================ */
.status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  margin-bottom: 1rem;
}
.status-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  min-height: 110px;
  padding: 1rem .75rem;
  border-radius: 16px;
  border: 3px solid;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
  background: var(--bg-card);
}
.status-btn:active { transform: scale(.96); }
.status-emoji { font-size: 2rem; }
.status-label { font-size: .85rem; font-weight: 900; letter-spacing: .5px; text-transform: uppercase; }
.status-desc  { font-size: .65rem; line-height: 1.35; text-align: center; opacity: .8; }

.status-green  { border-color: var(--green);  color: var(--green-light);  }
.status-yellow { border-color: var(--yellow); color: var(--yellow-light); }
.status-orange { border-color: #f97316;       color: #fb923c; }
.status-red    { border-color: var(--red);    color: var(--red-light);    }

.status-green.active  { background: var(--green-bg); box-shadow: 0 0 20px rgba(22,163,74,.3); }
.status-yellow.active { background: var(--yellow-bg);box-shadow: 0 0 20px rgba(217,119,6,.3); }
.status-orange.active { background: rgba(249,115,22,.12); box-shadow: 0 0 20px rgba(249,115,22,.3); }
.status-red.active    { background: var(--red-bg);   box-shadow: var(--shadow-red); }

/* ============================================================
   MEGA CHECKLIST
   ============================================================ */
.check-mega-list { display: flex; flex-direction: column; gap: .6rem; }
.check-mega-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem 1rem;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 14px;
  min-height: 70px;
  transition: all .2s;
}
.check-mega-item.cmi-ok  { border-color: var(--green); background: var(--green-bg); }
.check-mega-item.cmi-bad { border-color: var(--red);   background: var(--red-bg);   }
.cmi-icon { font-size: 1.4rem; flex-shrink: 0; }
.cmi-text { flex: 1; font-size: .88rem; font-weight: 600; color: var(--text-primary); line-height: 1.3; }
.cmi-btns { display: flex; gap: .4rem; flex-shrink: 0; }
.cmi-pass {
  min-width: 56px; min-height: 48px;
  background: rgba(22,163,74,.15);
  border: 2px solid var(--green);
  border-radius: 10px;
  color: var(--green-light);
  font-size: .8rem; font-weight: 800;
  cursor: pointer; font-family: inherit;
  transition: all .1s;
}
.cmi-fail {
  min-width: 56px; min-height: 48px;
  background: rgba(220,38,38,.1);
  border: 2px solid var(--red);
  border-radius: 10px;
  color: var(--red-light);
  font-size: .8rem; font-weight: 800;
  cursor: pointer; font-family: inherit;
  transition: all .1s;
}
.cmi-pass:active { background: var(--green); color: white; }
.cmi-fail:active { background: var(--red);   color: white; }
.cmi-ok .cmi-pass  { background: var(--green); color: white; }
.cmi-bad .cmi-fail { background: var(--red);   color: white; }

/* ============================================================
   BTU BIG NUMBER INPUT
   ============================================================ */
.btu-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 1.25rem;
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--border);
  margin-bottom: 1.25rem;
}
.btu-item { text-align: center; }
.btu-num  { font-size: 2rem; font-weight: 900; font-family: 'Courier New', monospace; }
.btu-lbl  { font-size: .65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-top: .2rem; }
.btu-separator { font-size: .9rem; color: var(--text-muted); font-weight: 700; }

.big-number-input {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: .75rem;
}
.btu-minus, .btu-plus {
  width: 72px; height: 72px;
  border-radius: 50%;
  border: 3px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 2rem;
  font-weight: 900;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .1s;
  font-family: inherit;
}
.btu-minus:active { background: var(--red-bg);   border-color: var(--red);   transform: scale(.93); }
.btu-plus:active  { background: var(--green-bg); border-color: var(--green); transform: scale(.93); }
.btu-count {
  font-size: 3.5rem;
  font-weight: 900;
  font-family: 'Courier New', monospace;
  color: var(--text-primary);
  min-width: 80px;
  text-align: center;
}
.btu-tap-hint { text-align: center; font-size: .72rem; color: var(--text-muted); margin-bottom: .5rem; }

.btu-achieve-wrap { margin-top: 1rem; }
.btu-achieve-bar-bg {
  height: 14px;
  background: var(--bg-card-alt);
  border-radius: 20px;
  overflow: hidden;
  margin-bottom: .4rem;
}
.btu-achieve-bar {
  height: 100%;
  border-radius: 20px;
  background: var(--green);
  transition: width .4s ease, background .3s;
}
.btu-achieve-label {
  text-align: center;
  font-size: .82rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* ============================================================
   YES / NO BUTTONS (Finding)
   ============================================================ */
.yesno-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-bottom: 1rem; }
.yesno-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-height: 130px;
  padding: 1rem .75rem;
  border-radius: 18px;
  border: 3px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}
.yesno-btn:active { transform: scale(.96); }
.yesno-label { font-size: .85rem; font-weight: 900; text-transform: uppercase; letter-spacing: .5px; }
.yesno-sub   { font-size: .65rem; text-align: center; opacity: .7; }
.yesno-no.active  { border-color: var(--green); background: var(--green-bg); color: var(--green-light); box-shadow: 0 0 18px rgba(22,163,74,.25); }
.yesno-yes.active { border-color: var(--red);   background: var(--red-bg);   color: var(--red-light);   box-shadow: var(--shadow-red); }

/* ============================================================
   DEPARTMENT CHIPS
   ============================================================ */
.dept-chip-wrap { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .5rem; }
.dept-chip {
  padding: .6rem 1rem;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 24px;
  color: var(--text-secondary);
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
  min-height: 44px;
}
.dept-chip:active { transform: scale(.95); }
.dept-chip.active { background: var(--red-bg); border-color: var(--red); color: var(--red-light); }

.sev-3btn { display: flex; gap: .5rem; margin-bottom: .5rem; }
.sev-chip {
  flex: 1;
  padding: .7rem;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--bg-card);
  font-size: .8rem;
  font-weight: 800;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  min-height: 50px;
  transition: all .15s;
}
.sev-minor { color: var(--yellow-light); }
.sev-major { color: #fb923c; }
.sev-crit  { color: var(--red-light); }
.sev-minor.active { border-color: var(--yellow); background: var(--yellow-bg); }
.sev-major.active { border-color: #f97316; background: rgba(249,115,22,.12); }
.sev-crit.active  { border-color: var(--red); background: var(--red-bg); }

/* ============================================================
   FORM FIELDS (mobile-optimised)
   ============================================================ */
.mob-field { margin-bottom: 1rem; }
.mob-label {
  display: block;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--text-muted);
  margin-bottom: .4rem;
}
.mob-required { color: var(--red-light); }
.mob-input {
  width: 100%;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: .85rem 1rem;
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  min-height: 54px;
  transition: border-color .15s;
  -webkit-appearance: none;
  appearance: none;
}
.mob-input:focus { outline: none; border-color: var(--red); }
.mob-input-lg { font-size: 1.1rem; min-height: 60px; font-weight: 600; }
.mob-textarea { min-height: 100px; resize: vertical; }
.mob-divider {
  text-align: center;
  font-size: .72rem;
  color: var(--text-muted);
  margin: .75rem 0;
  position: relative;
}
.mob-divider::before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 50%;
  border-top: 1px solid var(--border);
  z-index: 0;
}
.mob-divider span, .mob-divider {
  background: var(--bg-primary);
  padding: 0 .5rem;
  position: relative;
  z-index: 1;
}

/* ============================================================
   SUMMARY CARD
   ============================================================ */
.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.sum-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .6rem 0;
  border-bottom: 1px solid var(--border-subtle);
  gap: 1rem;
  font-size: .88rem;
}
.sum-row:last-child { border-bottom: none; }
.sum-lbl { color: var(--text-muted); font-size: .8rem; flex-shrink: 0; }
.sum-val { color: var(--text-primary); font-weight: 600; text-align: right; }

/* ============================================================
   TIMESTAMP LOCK
   ============================================================ */
.ts-lock-display {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: rgba(217,119,6,.1);
  border: 1px solid var(--yellow);
  border-radius: 12px;
  padding: .85rem 1rem;
  margin-bottom: 1rem;
}
.ts-lock-icon { font-size: 1.4rem; flex-shrink: 0; }
.ts-lock-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .5px; color: var(--yellow-light); font-weight: 700; }
.ts-lock-value { font-size: .82rem; font-family: 'Courier New', monospace; color: var(--text-primary); margin-top: .2rem; }

/* ============================================================
   LINK BUTTON
   ============================================================ */
.mob-link-btn {
  display: block;
  text-align: center;
  padding: .85rem;
  background: var(--bg-card);
  border: 2px solid var(--red);
  border-radius: 12px;
  color: var(--red-light);
  font-size: .9rem;
  font-weight: 700;
  margin-top: .75rem;
  text-decoration: none;
  transition: background .15s;
}
.mob-link-btn:active { background: var(--red-bg); }

/* ============================================================
   TOAST ERROR
   ============================================================ */
.step-error-toast {
  position: fixed;
  bottom: 5.5rem;
  left: 1rem; right: 1rem;
  background: var(--red-dark);
  border: 1px solid var(--red);
  border-radius: 12px;
  padding: .85rem 1rem;
  color: white;
  font-size: .88rem;
  font-weight: 600;
  z-index: 999;
  text-align: center;
  box-shadow: var(--shadow-red);
  transition: opacity .4s;
  animation: fadeSlide .2s ease;
}

/* ============================================================
   RESPONSIVE OVERRIDES
   ============================================================ */
@media (min-width: 600px) {
  .status-grid { grid-template-columns: repeat(4, 1fr); }
  .step-screen { max-width: 540px; margin: 0 auto; }
  .step-footer { max-width: 540px; margin-left: auto; margin-right: auto; }
}

/* ── Soft Light theme fixes (colors above are dark-mode tuned) ── */
html.theme-soft-light .status-orange { color: #c2410c; }
html.theme-soft-light .sev-major { color: #c2410c; }
html.theme-soft-light .sev-major.active { background: rgba(249,115,22,.10); }
