﻿/* ============================================================
   Thai Union Scanner – Shared Styles
   ============================================================ */

:root {
  --navy:        #002654;
  --accent:      #82C7EB;
  --bg:          #edf0f5;
  --white:       #FFFFFF;
  --text-dark:   #002654;
  --text-muted:  rgba(0, 38, 84, 0.4);
  --card-border: #c7dbf0;
  --gray-btn:    #d6d6d6;
  --fab:         #82c7eb;
  --overlay:     rgba(0, 38, 84, 0.55);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  height: 100%;
  background: rgba(0, 38, 84, 0.18);
}

body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

/* App shell */
.app {
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
  position: relative;
}

/* Header */
.app-header {
  background: var(--navy);
  padding: 18px 18px 22px;
  border-radius: 0 0 20px 20px;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.header-title {
  color: var(--accent);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.header-body {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.header-icon { flex-shrink: 0; }

/* Two-column grid for lot / palette pairs */
.header-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px 20px;
  color: white;
  font-size: 15px;
  line-height: 1.75;
  margin-top: -8px;
}

/* Single-column list for totals / stats */
.header-info-list {
  color: white;
  font-size: 15px;
  line-height: 1.75;
  margin-top: -8px;
}

.header-info-list .stat-main {
  font-size: 15px;
  font-weight: 700;
}

/* Tabs */
/* -- Main area (fills space below header) ---------------------- */
.main-area {
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* -- White card (35px below header, wraps tabs + content) ------ */
.white-card {
  position: absolute;
  top: 35px;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--white);
  border-radius: 16px 16px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tabs-bar {
  display: flex;
  gap: 10px;
  padding: 14px 16px 10px;
  flex-shrink: 0;
}

.tab-btn {
  flex: 1;
  padding: 14px 8px;
  /*border-radius: 28px;*/
  border-radius: 8px;
  border: 2px solid var(--navy);
  background: var(--white);
  color: var(--navy);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}

.tab-btn.active {
  background: var(--navy);
  color: var(--white);
}

/* Scrollable page content */
.page-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 16px 90px;
}

.tab-pane.hidden { display: none; }

/* Section label */
.section-label {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  color: #3a3a3a;
  letter-spacing: 0.3px;
  padding: 14px 0 8px;
}

/* Card group */
.card-group {
  background: var(--white);
  border-radius: 12px;
  border: 1px solid var(--card-border);
  overflow: hidden;
  margin-bottom: 10px;
}

.card-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 15px;
  border-bottom: 1px solid var(--card-border);
}
.card-item:last-child { border-bottom: none; }

.card-item.not-registered .card-title,
.card-item.not-registered .card-meta {
  color: var(--text-muted);
}

.card-item.not-registered .outgoing-icon {
  fill: var(--text-muted) !important;
}

.card-icon {
  flex-shrink: 0;
  width: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 4px;
}

.card-body  { flex: 1; min-width: 0; }

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 3px;
}

.card-meta {
  font-size: 15px;
  color: var(--text-dark);
  line-height: 1.65;
}
.card-meta strong { color: var(--text-dark); }
.card-meta .sep   { margin: 0 6px; color: var(--card-border); }

/* Bottom nav */

.bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  padding: 10px 16px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;

}

.nav-pill {
  background: var(--navy);
  /*border-radius: 40px;*/
  border-radius: 8px;
  padding: 10px 22px;
  display: flex;
  align-items: center;
  gap: 22px;
}

.nav-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.65;
  transition: opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.nav-btn.active, .nav-btn:hover { opacity: 1; }

.nav-fab {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--fab);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(0,0,0,0.20);
  transition: transform 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.nav-fab:active { transform: scale(0.93); }

/* Form page */

.form-wrapper {
  margin-top: 35px;
  background: var(--white);
  border-radius: 16px 16px 0 0;
  flex: 1;
  position: relative;
  overflow: hidden;
}

.form-scroll {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 22px 16px 110px; /* bottom pad creates space for action bar */
}

.form-actions {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 10px;
  padding: 14px 16px 20px;
  /* fade so form content reads as going "behind" the bar */
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, var(--white) 28%);
}

.form-group { margin-bottom: 22px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: #3a3a3a;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--accent);
  border-radius: 10px;
  font-size: 14px;
  color: var(--text-dark);
  background: var(--white);
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s, color 0.2s;
}
.form-input:focus {
  border-color: var(--navy);
  color: var(--text-dark);
}
.form-input::placeholder {
  color: var(--accent);
  opacity: 0.9;
  letter-spacing: 0.5px;
}

.btn-cancel {
  flex: 1;
  padding: 16px;
  border-radius: 12px;
  border: none;
  background: var(--gray-btn);
  color: var(--text-dark);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
}

.btn-save {
  flex: 1;
  padding: 16px;
  border-radius: 12px;
  border: 2px solid var(--navy);
  background: var(--white);
  color: var(--navy);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.btn-save:hover { background: var(--navy); color: var(--white); }

/* Modal / Popup */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  z-index: 200;
}
.modal-overlay.hidden { display: none; }

.modal-box {
  background: var(--white);
  border-radius: 20px;
  width: 100%;
  max-width: 380px;
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 12px 44px rgba(0,0,0,0.28);
}

.modal-title {
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  color: var(--navy);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 22px 20px 16px;
  flex-shrink: 0;
}

.modal-options {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 18px 4px;
}

.modal-option {
  display: block;
  width: 100%;
  padding: 15px;
  border: 2px solid var(--navy);
  border-radius: 12px;
  background: var(--white);
  color: var(--navy);
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  cursor: pointer;
  margin-bottom: 10px;
  text-align: center;
  font-family: inherit;
  transition: background 0.12s, color 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.modal-option:last-child { margin-bottom: 0; }
.modal-option:hover, .modal-option:active { background: var(--navy); color: var(--white); }

.modal-footer {
  flex-shrink: 0;
  padding: 10px 18px 20px;
}

.modal-cancel {
  display: block;
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 12px;
  background: var(--gray-btn);
  color: var(--text-dark);
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
}

/* PIN page */
.pin-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 24px 24px 32px;
  overflow: hidden;
}

.pin-logo {
  margin-bottom: 36px;
  display: flex;
  justify-content: center;
}
.pin-logo img {
  max-width: 220px;
  max-height: auto;
  object-fit: contain;
}

.pin-prompt {
  font-size: 13px;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 24px;
}

.pin-dots {
  display: flex;
  gap: 22px;
  margin-bottom: 44px;
}
.pin-dot {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  border: 2.5px solid var(--navy);
  background: transparent;
  transition: background 0.12s;
}
.pin-dot.filled { background: var(--navy); }

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 310px;
}

.pin-key {
  background: var(--white);
  border: none;
  border-radius: 14px;
  font-size: 22px;
  font-weight: 500;
  color: var(--navy);
  cursor: pointer;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  transition: background 0.1s;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
}
.pin-key:active { background: var(--card-border); }
.pin-key.ghost   { background: transparent; box-shadow: none; pointer-events: none; }

/* Index / menu */
.menu-page {
  flex: 1;
  overflow-y: auto;
  padding: 24px 16px;
}
.menu-page h1 {
  font-size: 20px;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 20px;
}
.menu-list { list-style: none; }
.menu-list li { margin-bottom: 10px; }
.menu-list a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: var(--white);
  border-radius: 12px;
  border: 1px solid var(--card-border);
  color: var(--navy);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.15s;
}
.menu-list a:hover { background: var(--card-border); }
.menu-badge {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-left: auto;
}

/* Allow <a> tags to be used as nav items */
a.nav-btn,
a.nav-fab {
  text-decoration: none;
  color: inherit;
}

/* Index page: header without bottom margin */
.header-title.no-margin {
  margin-bottom: 0;
}

/* Menu list: prevent SVG icons from shrinking */
.menu-list a svg {
  flex-shrink: 0;
}

/* Popup demo page */
.demo-placeholder {
  padding: 16px 0;
  color: var(--text-muted);
  font-size: 14px;
}

.btn-demo {
  padding: 12px 20px;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  letter-spacing: 0.5px;
}

/* Responsive tweaks */
@media (max-height: 680px) {
  .pin-logo       { margin-bottom: 20px; }
  .pin-dots       { margin-bottom: 24px; }
  .pin-prompt     { margin-bottom: 14px; }
  .pin-key        { min-height: 54px; font-size: 18px; }
}

@media (max-width: 360px) {
  .tabs-bar       { gap: 6px; padding: 12px 12px 8px; }
  .tab-btn        { font-size: 11.5px; padding: 10px 6px; }
  .page-content,
  .form-scroll    { padding-left: 12px; padding-right: 12px; }
  .nav-pill       { padding: 10px 16px; gap: 16px; }
}
