@import url('https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;600;700;800&family=IBM+Plex+Sans+Thai:wght@300;400;500;600;700&family=Noto+Sans+SC:wght@400;500;700;900&family=Noto+Sans+Myanmar:wght@400;500;600;700&display=swap');

:root {
  --font-thai: 'IBM Plex Sans Thai', 'Noto Sans SC', 'Noto Sans Myanmar', sans-serif;
  --font-num: 'Chakra Petch', 'Plus Jakarta Sans', sans-serif;
  
  --tv-bg: #090d16;
  --tv-surface: #111827;
  --tv-surface-subtle: #0d1322;
  --tv-border: #1e3a8a;
  --tv-border-hover: #334155;
  
  --tv-text-main: #ffffff;
  --tv-text-muted: #94a3b8;
  --tv-text-dim: #64748b;

  --tv-highlight: #f59e0b;
  --tv-highlight-glow: rgba(245, 158, 11, 0.25);
  --tv-accent: #38bdf8;
  --tv-success: #10b981;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

::-webkit-scrollbar {
  display: none !important;
  width: 0px !important;
  height: 0px !important;
  background: transparent !important;
}

body {
  font-family: var(--font-thai);
  margin: 0;
  padding: 0;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ===================================================
   UPLOAD PAGE SPECIFIC STYLES & DIRECT LIVE CONTROLLER
   =================================================== */
body.page-upload {
  background-color: #f1f5f9;
  color: #0f172a;
}

.upload-nav {
  background: #0f172a;
  color: #ffffff;
  padding: 14px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #2563eb;
}

.upload-container {
  max-width: 1360px;
  margin: 24px auto;
  padding: 0 20px;
}

/* LIVE REAL-TIME DASHBOARD CONTROLLER PANEL */
.live-controller-card {
  background: #ffffff;
  border: 2px solid #2563eb;
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.12);
  position: relative;
}

.live-control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

@media (max-width: 860px) {
  .live-control-grid {
    grid-template-columns: 1fr;
  }
}

.live-num-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.live-num-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14.5px;
  font-weight: 700;
}

.live-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-big-input {
  flex: 1;
  font-family: var(--font-num);
  font-size: 32px;
  font-weight: 800;
  padding: 8px 14px;
  border-radius: 8px;
  border: 2px solid #cbd5e1;
  outline: none;
  background: #ffffff;
  text-align: center;
  transition: border-color 0.15s;
}

.live-big-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.step-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 8px 12px;
  font-family: var(--font-num);
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.step-btn:hover {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}

.step-btn-minus:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
}

/* HUB LIVE ADJUSTER LIST */
.hub-live-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  margin-top: 12px;
  max-height: 320px;
  overflow-y: auto;
  padding: 10px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.hub-live-item {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hub-live-title {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hub-live-input {
  width: 70px;
  font-family: var(--font-num);
  font-size: 15px;
  font-weight: 700;
  padding: 4px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  text-align: right;
}

.upload-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.upload-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
  flex-wrap: wrap;
  gap: 10px;
}

.upload-dropzone-box {
  border: 2px dashed #cbd5e1;
  border-radius: 10px;
  padding: 24px 20px;
  text-align: center;
  background: #fafbfc;
  cursor: pointer;
  transition: all 0.2s ease;
}

.upload-dropzone-box:hover {
  border-color: #2563eb;
  background: #eff6ff;
}

/* ===================================================
   TV DISPLAY PAGE: HUGE CLOCK, 2 HERO CARDS & MULTILINGUAL
   =================================================== */
body.page-tv {
  background-color: var(--tv-bg);
  color: var(--tv-text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

body.page-tv::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 50% 10%, rgba(37, 99, 235, 0.08) 0%, transparent 60%),
              radial-gradient(circle at 20% 80%, rgba(245, 158, 11, 0.04) 0%, transparent 40%);
  pointer-events: none;
  z-index: 0;
}

.tv-scanline {
  position: fixed;
  top: -100px;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(180deg, transparent 0%, rgba(56, 189, 248, 0.06) 50%, transparent 100%);
  pointer-events: none;
  z-index: 99;
  animation: scan-sweep 8s linear infinite;
}

@keyframes scan-sweep {
  0% { transform: translateY(0vh); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(120vh); opacity: 0; }
}

/* TV Top Bar */
.tv-navbar {
  background: linear-gradient(180deg, #091022 0%, #0d152a 100%);
  border-bottom: 2px solid #1e3a8a;
  padding: 10px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 10;
  flex-wrap: wrap;
  gap: 12px;
}

.tv-brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.tv-live-beacon {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #111827;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid #1e293b;
}

.beacon-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: beacon-ripple 1.8s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes beacon-ripple {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.8); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.beacon-text {
  font-family: var(--font-num);
  font-size: 12px;
  font-weight: 700;
  color: #10b981;
  letter-spacing: 0.08em;
}

.tv-title-text {
  font-size: 19px;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tv-branch-tag {
  font-size: 13.5px;
  background: #1e3a8a;
  color: #93c5fd;
  padding: 3px 12px;
  border-radius: 6px;
  font-weight: 600;
  border: 1px solid #3b82f6;
}

/* 15-SECOND AUTO LANGUAGE ROTATOR BADGE */
.lang-rotator-badge {
  display: flex;
  align-items: center;
  background: #0f1c3f;
  border: 1.5px solid #2563eb;
  padding: 5px 12px;
  border-radius: 20px;
  gap: 8px;
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.3);
  cursor: pointer;
}

.lang-flag {
  font-size: 16px;
}

.lang-current-label {
  font-size: 13px;
  font-weight: 700;
  color: #38bdf8;
}

.lang-timer-pill {
  background: #1e3a8a;
  color: #fde68a;
  font-family: var(--font-num);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
}

/* HUGE DIGITAL CLOCK FOR WAREHOUSE TV */
.tv-clock-box {
  background: #050a17;
  border: 2px solid #2563eb;
  padding: 4px 18px;
  border-radius: 10px;
  text-align: right;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 0 16px rgba(37, 99, 235, 0.35);
}

.tv-clock-time {
  font-family: var(--font-num);
  font-size: 38px;
  font-weight: 800;
  color: #38bdf8;
  line-height: 1.0;
  letter-spacing: 0.05em;
  text-shadow: 0 0 16px rgba(56, 189, 248, 0.5);
}

.tv-clock-date {
  font-size: 11.5px;
  font-weight: 500;
  color: #94a3b8;
  margin-top: 2px;
}

.tv-body-container {
  padding: 18px 28px;
  max-width: 1920px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  z-index: 10;
}

/* 2 MASSIVE HERO METRIC CARDS */
.tv-stats-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 20px;
}

@media (max-width: 992px) {
  .tv-stats-grid-2 {
    grid-template-columns: 1fr;
  }
}

.tv-hero-card {
  background: var(--tv-surface);
  border: 1px solid var(--tv-border);
  border-radius: 14px;
  padding: 22px 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* TOTAL INBOUND CARD */
.tv-hero-card.c-inbound {
  border-color: #2563eb;
  background: linear-gradient(180deg, #0f1c3f 0%, #111827 100%);
}

.tv-hero-card.c-inbound .tv-hero-num {
  font-family: var(--font-num);
  font-size: 74px;
  font-weight: 800;
  line-height: 1.0;
  color: #ffffff;
  margin: 8px 0 4px 0;
  letter-spacing: -0.02em;
}

/* PENDING DISPATCH CARD (MAIN HIGHLIGHT) */
.tv-hero-card.is-focus {
  background: linear-gradient(180deg, #1c2744 0%, #111827 100%);
  border: 2px solid var(--tv-highlight);
  animation: pending-glow 3s ease-in-out infinite alternate;
}

@keyframes pending-glow {
  0% { box-shadow: 0 0 18px rgba(245, 158, 11, 0.2), inset 0 0 12px rgba(245, 158, 11, 0.05); }
  100% { box-shadow: 0 0 35px rgba(245, 158, 11, 0.45), inset 0 0 24px rgba(245, 158, 11, 0.12); }
}

.tv-hero-card.is-focus .tv-hero-num {
  font-family: var(--font-num);
  font-size: 78px;
  font-weight: 800;
  line-height: 1.0;
  color: var(--tv-highlight);
  margin: 8px 0 4px 0;
  letter-spacing: -0.02em;
  text-shadow: 0 0 30px rgba(245, 158, 11, 0.5);
}

.tv-hero-title {
  font-size: 15px;
  font-weight: 700;
  color: #cbd5e1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tv-hero-card.is-focus .tv-hero-title {
  color: #fde68a;
}

.tv-hero-bottom {
  font-size: 13px;
  color: var(--tv-text-muted);
  border-top: 1px solid var(--tv-border);
  padding-top: 8px;
  margin-top: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tv-hero-card.is-focus .tv-hero-bottom {
  color: #cbd5e1;
}

/* Progress Bar */
.tv-progress-container {
  background: var(--tv-surface);
  border: 1px solid var(--tv-border);
  border-radius: 12px;
  padding: 12px 20px;
}

.tv-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  font-weight: 600;
  color: var(--tv-text-muted);
}

.tv-progress-header strong {
  color: #ffffff;
}

.tv-progress-bar-track {
  height: 12px;
  background: #090d16;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  border: 1px solid var(--tv-border);
  margin-top: 6px;
  position: relative;
}

.tv-fill-waiting {
  background: linear-gradient(90deg, #d97706 0%, #f59e0b 100%);
  height: 100%;
  transition: width 0.6s ease;
  position: relative;
  overflow: hidden;
}

.tv-fill-waiting::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.4) 50%, transparent 100%);
  animation: bar-shine 2.5s infinite;
}

@keyframes bar-shine {
  0% { left: -100%; }
  100% { left: 200%; }
}

/* Lower 2 Columns (50% / 50% split for huge video view) */
.tv-lower-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  flex: 1;
}

@media (max-width: 1100px) {
  .tv-lower-grid {
    grid-template-columns: 1fr;
  }
}

.tv-box-panel {
  background: var(--tv-surface);
  border: 1px solid var(--tv-border);
  border-radius: 12px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
}

.tv-box-header {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--tv-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#tvHubRankingBox {
  height: 430px;
  overflow: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

#tvHubRankingBox::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.tv-hub-item-row {
  display: flex;
  align-items: center;
  padding: 9px 14px;
  background: #090d16;
  border: 1px solid #1e293b;
  border-radius: 8px;
  margin-bottom: 7px;
  gap: 12px;
  transition: all 0.3s ease;
}

.tv-hub-item-row.is-top1 {
  border-color: rgba(245, 158, 11, 0.4);
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.08) 0%, #090d16 100%);
}

.tv-hub-badge {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: #1e293b;
  color: #ffffff;
  font-family: var(--font-num);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tv-hub-badge.top1 {
  background: #f59e0b;
  color: #000000;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.tv-hub-title {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tv-hub-meter {
  width: 110px;
  height: 7px;
  background: #1e293b;
  border-radius: 4px;
  overflow: hidden;
}

.tv-hub-meter-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb 0%, #38bdf8 100%);
  border-radius: 4px;
}

.tv-hub-qty-num {
  font-family: var(--font-num);
  font-size: 15.5px;
  font-weight: 700;
  color: #38bdf8;
  width: 70px;
  text-align: right;
}

.tv-hub-pct-num {
  font-size: 12px;
  color: var(--tv-text-muted);
  width: 45px;
  text-align: right;
}

/* ===================================================
   EXPANDED FULL-SIZE TV VIDEO BROADCAST PLAYER
   =================================================== */
.mini-tv-screen-box {
  width: 100%;
  height: 100%;
  min-height: 430px;
  border-radius: 10px;
  overflow: hidden;
  background: #000000;
  border: 2px solid #1e3a8a;
  position: relative;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  flex: 1;
}

.mini-tv-iframe {
  width: 100%;
  height: calc(100% - 36px);
  min-height: 390px;
  border: none;
  display: block;
  flex: 1;
}

.mini-tv-footer-ticker {
  background: #0d152a;
  border-top: 1px solid #1e3a8a;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #94a3b8;
  height: 36px;
  flex-shrink: 0;
}

.mini-tv-live-pill {
  background: #ef4444;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  font-family: var(--font-num);
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-thai);
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-primary { background: #2563eb; color: #ffffff; }
.btn-primary:hover { background: #1d4ed8; }

.btn-outline { background: #ffffff; color: #334155; border-color: #cbd5e1; }
.btn-outline:hover { background: #f1f5f9; }

.btn-tv { background: #1e293b; color: #ffffff; border-color: #334155; }
.btn-tv:hover { background: #334155; border-color: #475569; }

.btn-sm { padding: 5px 10px; font-size: 12px; }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}
.tag-hub { background: #f1f5f9; color: #1e293b; border: 1px solid #cbd5e1; font-weight: 600; }
.tag-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.tag-warning { background: #fffbeb; color: #854d0e; border: 1px solid #fef08a; }
