/* ==========================================================================
   GetPackSure Core Components (Round 1)
   Theme: Professional Navy + Orange
   ========================================================================== */

/* Universal minimum touch target height for component buttons & interactive classes (>= 44px) */
.btn,
.btn-primary,
.btn-navy,
.btn-outline {
  min-height: 44px;
  min-width: 44px;
  box-sizing: border-box;
}

/* Base interactive button styles */
.btn,
.btn-primary,
.btn-navy,
.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  line-height: 1.25;
}

/* 1. .btn-primary */
/* พื้น var(--orange) ตัวอักษร var(--navy-dark) (contrast ratio 6.05:1 ผ่านเกณฑ์ WCAG AA > 4.5:1)
   สูง 54px, radius var(--radius), font var(--font-head) 600 */
.btn-primary {
  height: 54px;
  min-height: 54px;
  background-color: var(--orange);
  color: var(--navy-dark) !important;
  border-radius: var(--radius);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1rem;
  padding: 0 24px;
  border: none;
  box-shadow: 0 2px 6px rgba(247, 115, 28, 0.18);
}

.btn-primary:hover {
  background-color: #E2620E;
  color: var(--navy-dark) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(247, 115, 28, 0.28);
}

.btn-primary:active {
  transform: translateY(0);
}

/* 2. .btn-navy */
/* พื้น var(--navy) ตัวอักษรขาว, สูง 54px, radius var(--radius), font var(--font-head) 600 */
.btn-navy {
  height: 54px;
  min-height: 54px;
  background-color: var(--navy);
  color: #FFFFFF !important;
  border-radius: var(--radius);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1rem;
  padding: 0 24px;
  border: none;
  box-shadow: 0 2px 6px rgba(15, 42, 74, 0.16);
}

.btn-navy:hover {
  background-color: var(--navy-dark);
  color: #FFFFFF !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(10, 28, 51, 0.25);
}

.btn-navy:active {
  transform: translateY(0);
}

/* 3. .btn-outline */
/* ขอบ var(--navy) ตัวอักษร var(--navy) (บนพื้นกรมท่าใช้ขอบขาวโปร่ง 35%), สูง 54px */
.btn-outline {
  height: 54px;
  min-height: 54px;
  background-color: transparent;
  color: var(--navy) !important;
  border: 1.5px solid var(--navy);
  border-radius: var(--radius);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1rem;
  padding: 0 22px;
}

.btn-outline:hover {
  background-color: rgba(15, 42, 74, 0.05);
  border-color: var(--navy-dark);
  color: var(--navy-dark) !important;
}

.btn-outline:active {
  transform: translateY(0);
}

/* บนพื้นกรมท่า: ขอบขาวโปร่ง 35% */
.bg-navy .btn-outline,
.navy-bg .btn-outline,
.hero-section .btn-outline,
.hero-navy .btn-outline,
.cta-navy .btn-outline,
.btn-outline.on-navy,
.btn-outline-navy-bg,
[data-theme="navy"] .btn-outline {
  border-color: rgba(255, 255, 255, 0.35);
  color: #FFFFFF !important;
  background-color: transparent;
}

.bg-navy .btn-outline:hover,
.navy-bg .btn-outline:hover,
.hero-section .btn-outline:hover,
.hero-navy .btn-outline:hover,
.cta-navy .btn-outline:hover,
.btn-outline.on-navy:hover,
.btn-outline-navy-bg:hover,
[data-theme="navy"] .btn-outline:hover {
  border-color: #FFFFFF;
  background-color: rgba(255, 255, 255, 0.12);
  color: #FFFFFF !important;
}

/* Compact button variants for dense areas maintaining >= 44px tap target */
.btn-sm,
.btn.small {
  height: 44px;
  min-height: 44px;
  padding: 0 16px;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
}

/* 4. .card */
/* พื้นขาว ขอบ 1px var(--line) radius var(--radius-lg) ไม่ใช้เงาหนัก */
.card {
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 8px rgba(15, 42, 74, 0.03);
  box-sizing: border-box;
}

/* 5. .chip */
/* ป้ายสถานะทรงแคปซูล ตัวอักษร var(--navy-dark) พื้นตามสถานะ
   (กำลังแพ็ค/กำลังจัดส่ง = --orange-chip, แพ็คแล้ว = --success-chip, รอ = #E6ECF4) */
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 9999px;
  padding: 4px 12px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--navy-dark);
  white-space: nowrap;
}

/* กำลังแพ็ค / กำลังจัดส่ง */
.chip.chip-packing,
.chip.chip-shipping,
.chip.chip-orange,
.chip.is-packing,
.chip.is-shipping,
.chip[data-status="packing"],
.chip[data-status="in_transit"],
.chip[data-status="out_for_delivery"] {
  background-color: var(--orange-chip);
  color: var(--navy-dark);
}

/* แพ็คแล้ว / จัดส่งแล้ว */
.chip.chip-packed,
.chip.chip-shipped,
.chip.chip-delivered,
.chip.chip-success,
.chip.is-packed,
.chip.is-delivered,
.chip[data-status="packed"],
.chip[data-status="shipped"],
.chip[data-status="delivered"] {
  background-color: var(--success-chip);
  color: var(--navy-dark);
}

/* รอ / รอแพ็คสินค้า */
.chip.chip-pending,
.chip.chip-waiting,
.chip.chip-muted,
.chip.is-pending,
.chip[data-status="pending"] {
  background-color: #E6ECF4;
  color: var(--navy-dark);
}

/* 6. Inline SVG Icons - strictly scoped to .icon and .icon-svg */
.icon,
.icon-svg {
  stroke-width: 2px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: inline-block;
  vertical-align: middle;
}

.icon-svg-sm {
  width: 16px;
  height: 16px;
  stroke-width: 2px;
}

.icon-svg-md {
  width: 20px;
  height: 20px;
  stroke-width: 2px;
}

.icon-svg-lg {
  width: 24px;
  height: 24px;
  stroke-width: 2px;
}

/* 7. Theme Toggle Button (Light/Dark Mode) */
.btn-theme-toggle {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--heading);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  box-sizing: border-box;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-theme-toggle:hover {
  background: var(--bg);
  border-color: var(--line-strong);
}

.btn-theme-toggle .icon-sun {
  display: none;
}

.btn-theme-toggle .icon-moon {
  display: block;
}

[data-theme="dark"] .btn-theme-toggle {
  background: #121A2B;
  border-color: #24324A;
  color: #F1F4F9;
}

[data-theme="dark"] .btn-theme-toggle:hover {
  background: #172136;
  border-color: #3A4A66;
}

[data-theme="dark"] .btn-theme-toggle .icon-sun {
  display: block;
}

[data-theme="dark"] .btn-theme-toggle .icon-moon {
  display: none;
}

/* Hide theme toggle on pages outside homepage */
html:not([data-page="home"]) .btn-theme-toggle {
  display: none !important;
}

/* 8. Logo Switching based on data-theme */
.logo-dark {
  display: none !important;
  content: normal !important;
}

.logo-light {
  display: block !important;
  content: normal !important;
}

[data-theme="dark"] .logo-dark {
  display: block !important;
}

[data-theme="dark"] .logo-light {
  display: none !important;
}

[data-theme="light"] .logo-dark {
  display: none !important;
}

[data-theme="light"] .logo-light {
  display: block !important;
}

/* 9. .btn-on (Secondary outline button) */
.btn-on {
  border: 1.5px solid var(--btn-on-border, var(--navy));
  color: var(--btn-on-text, var(--navy)) !important;
  background: var(--btn-on-bg, #FFFFFF);
}

[data-theme="dark"] .btn-on {
  border-color: #3A4A66;
  color: #F1F4F9 !important;
  background: #121A2B;
}

/* ==========================================================================
   10. GetPackSure Customer Tracking Page (/t/<token>) Components (Round 3)
   Theme: Professional Navy + Orange
   ========================================================================== */

.trk-page-wrap {
  width: 100%;
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  font-family: var(--font-body);
  color: var(--text);
  box-sizing: border-box;
}

.trk-container {
  width: min(480px, 100%);
  min-height: 100vh;
  box-sizing: border-box;
  background: var(--bg);
  font-family: var(--font-body);
  color: var(--text);
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(10, 28, 51, 0.05);
}

.trk-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.trk-shop-logo {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: #E6ECF4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  flex: none;
  overflow: hidden;
}

.trk-shop-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.trk-shop-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.trk-shop-name {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 17px;
  color: var(--text);
}

.trk-order-no {
  font-size: 13px;
  color: var(--text-muted);
}

.trk-sec-video {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.trk-title {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 22px;
  color: var(--heading);
}

.trk-video-wrap {
  position: relative;
  border-radius: 18px;
  background: #0F2A4A;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16/9;
  box-shadow: 0 6px 24px rgba(10, 28, 51, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
}

.trk-video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 18px;
  background: #000;
}

.trk-badge-time {
  position: absolute;
  top: 12px;
  left: 12px;
  font-size: 12px;
  font-weight: 600;
  color: #FFFFFF;
  background: rgba(10, 28, 51, 0.75);
  padding: 5px 10px;
  border-radius: 999px;
  z-index: 2;
  pointer-events: none;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.trk-video-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.trk-video-caption {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
  flex: 1;
  min-width: 180px;
}

.trk-btn-download {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--navy);
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex: none;
}

.trk-btn-download:hover {
  background: var(--bg);
  border-color: var(--navy);
}

.trk-no-video {
  background: var(--surface);
  border: 1.5px dashed var(--line);
  border-radius: 18px;
  padding: 32px 18px;
  text-align: center;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.trk-no-video-icon {
  font-size: 32px;
  margin-bottom: 2px;
}

.trk-no-video-title {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
  color: var(--heading);
}

.trk-no-video-text {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.trk-card {
  margin: 0 20px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-sizing: border-box;
}

.trk-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.trk-card-title {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 18px;
  color: var(--heading);
}

.trk-badge-status {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  line-height: 1;
}

.trk-badge-status.s-shipped,
.trk-badge-status.s-in_transit,
.trk-badge-status.s-out_for_delivery {
  background: #FFE2CC;
  color: #0A1C33;
}

.trk-badge-status.s-packed {
  background: #BFE6D2;
  color: #0A1C33;
}

.trk-badge-status.s-delivered {
  background: #D4F5E2;
  color: #052E14;
}

.trk-badge-status.s-pending,
.trk-badge-status.s-packing {
  background: #E6ECF4;
  color: #14213D;
}

.trk-badge-status.s-cancelled,
.trk-badge-status.s-returned {
  background: #FEE2E2;
  color: #991B1B;
}

.trk-timeline {
  display: flex;
  flex-direction: column;
  margin: 4px 0;
}

.trk-step {
  display: flex;
  gap: 12px;
  min-height: 48px;
}

.trk-step-axis {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: none;
  width: 22px;
}

.trk-step-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  box-sizing: border-box;
}

.trk-step-dot.past {
  background: #0F2A4A;
  color: #FFFFFF;
}

.trk-step-dot.current {
  background: var(--orange);
  border: 4px solid #FFE2CC;
}

.trk-step-dot.future {
  background: #FFFFFF;
  border: 2px solid #C3CCD9;
}

.trk-step-line {
  width: 2px;
  flex: 1;
  min-height: 24px;
}

.trk-step-line.past {
  background: #0F2A4A;
}

.trk-step-line.future {
  background: #DDE3EC;
}

.trk-step-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 14px;
}

.trk-step-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.trk-step-title.future {
  font-weight: 500;
  color: var(--text-muted);
}

.trk-step-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.trk-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg);
  border-radius: 12px;
  padding: 10px 12px;
}

.trk-box-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.trk-box-label {
  font-size: 12px;
  color: var(--text-muted);
}

.trk-box-no {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
  font-family: ui-monospace, monospace;
  color: var(--text);
}

.trk-btn-copy {
  height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--navy);
  background: #FFFFFF;
  color: var(--navy);
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  flex: none;
}

.trk-btn-copy:hover {
  background: var(--navy);
  color: #FFFFFF;
}

.trk-items {
  display: flex;
  flex-direction: column;
}

.trk-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  color: var(--text);
}

.trk-item-row:last-child {
  border-bottom: none;
}

.trk-item-name {
  font-weight: 500;
}

.trk-item-qty {
  font-family: ui-monospace, monospace;
  font-weight: 600;
  color: var(--text-muted);
}

.trk-items-platform {
  padding: 12px 0;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}

.trk-consent-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.trk-consent-title {
  margin: 0;
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 600;
  color: var(--heading);
}

.trk-consent-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.trk-consent-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  width: 100%;
}

.trk-consent-cb {
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin-top: 3px;
  cursor: pointer;
  accent-color: var(--navy);
}

.trk-consent-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  flex: 1;
}

.trk-btn-consent-revoke {
  border: 1px solid var(--line);
  background: #FFFFFF;
  color: var(--text-muted);
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  flex: none;
}

.trk-btn-consent-revoke:hover {
  border-color: var(--navy);
  color: var(--navy);
}

.trk-action-sec {
  padding: 4px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.trk-btn-contact {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  border-radius: 14px;
  background: #0F2A4A;
  color: #FFFFFF !important;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  width: 100%;
  transition: background 0.15s ease;
  box-sizing: border-box;
}

.trk-btn-contact:hover {
  background: #0A1C33;
}

.trk-btn-back {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--line);
  transition: all 0.15s ease;
}

.trk-btn-back:hover {
  background: var(--surface);
  color: var(--text);
}

.trk-footer {
  margin-top: auto;
  padding: 18px 20px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-top: 1px solid var(--line);
}

.trk-footer-link {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
}

.trk-footer-brand {
  font-weight: 600;
  color: var(--navy);
}

.trk-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 28, 51, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 20px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.trk-modal-box {
  background: #FFFFFF;
  border-radius: 20px;
  padding: 24px;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border: 1px solid var(--line);
  box-sizing: border-box;
}

.trk-modal-title {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
}

.trk-modal-msg {
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
  margin: 0;
}

.trk-modal-close-btn {
  height: 46px;
  border-radius: 12px;
  background: var(--navy);
  color: #FFFFFF;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 15px;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.trk-modal-close-btn:hover {
  background: var(--navy-dark);
}

/* Search Box Form on /track */
.trk-search-wrap {
  width: min(480px, 100%);
  padding: 24px 20px;
  box-sizing: border-box;
}

.trk-search-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
}

.trk-search-head {
  text-align: center;
}

.trk-search-head h1 {
  margin: 0 0 6px;
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 700;
  color: var(--heading);
}

.trk-search-head p {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.trk-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.trk-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.trk-input {
  width: 100%;
  height: 48px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  padding: 0 14px;
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  box-sizing: border-box;
  transition: border-color 0.15s ease;
}

.trk-input:focus {
  outline: none;
  border-color: var(--navy);
}

.trk-btn-submit {
  width: 100%;
  height: 50px;
  border-radius: 12px;
  background: var(--orange);
  color: var(--navy-dark) !important;
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
  transition: filter 0.15s ease;
}

.trk-btn-submit:hover {
  filter: brightness(0.96);
}

.trk-search-note {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
  padding: 10px;
  border-radius: 10px;
  background: var(--bg);
}


/* Pioneer Privilege Banner */
.pioneer-banner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(255, 90, 0, 0.08);
  color: var(--orange);
  font-weight: 600;
  font-size: 14px;
  border: 1px solid rgba(255, 90, 0, 0.25);
  text-decoration: none;
  line-height: 1.4;
  transition: all 0.2s ease;
}
.pioneer-banner[hidden] {
  display: none !important;
}
.pioneer-banner .pioneer-icon {
  font-size: 15px;
  line-height: 1;
}
.pioneer-banner b {
  font-weight: 700;
  color: var(--orange);
}
[data-theme="dark"] .pioneer-banner {
  background: rgba(255, 122, 51, 0.12);
  border-color: rgba(255, 122, 51, 0.35);
  color: #ff9d66;
}
[data-theme="dark"] .pioneer-banner b {
  color: #ff9d66;
}
