/* styles.css — Walkie Tracker (phone-fit) */

* { box-sizing: border-box; }

html, body{
  height: 100%;
  margin: 0;
  padding: 0;
}

:root{
  --blue: #243bff;
  --blue-dark: #1828b8;
  --gold: #b08a1b;

  --row-alt: #f4f4f4;

  --out-red: #b40000;
  --in-green: #7b9850;

  --surv-yellow: #c9ab2d;
  --surv-gray: #8f8f8f;
  --surv-red: #d30000;
  --surv-green: #7b9850;

  /* Fixed layout sizing */
  --topbar-h: 56px;          /* desktop header height (without safe-area) */
  --footer-h: 44px;
  --footer-h-mobile: 56px;
}

body{
  background:#fff;
  color:#111;
  font-family: Helvetica, Arial, "Helvetica Neue", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Content must clear the fixed header (includes iOS safe-area) */
  padding-top: calc(var(--topbar-h) + env(safe-area-inset-top));
}

/* ========================================================================
   Top bar (FIXED)
   ======================================================================== */
.topbar{
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2000;

  background: linear-gradient(90deg, #050508 0%, #0e0e14 55%, #050508 100%);
  color:#fff;

  /* iOS safe-area */
  padding: calc(14px + env(safe-area-inset-top)) 18px 14px;

  /* KEY CHANGE: topbar is a vertical stack:
     row 1 = title + updated
     row 2 = nav (and it can wrap) */
  display:flex;
  flex-direction: column;
  gap: 10px;
}

/* Row that holds title + updated on one line */
.topbar-row{
  display:flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.title{
  text-align: center;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:0.30em;
  font-size:22px;
  line-height:1.1;
  white-space: nowrap;
}

.lastupdate{
  font-weight:700;
  font-size:16px;
  opacity:.9;
  white-space: nowrap;
}

/* ---- Top nav ---- */
.topnav{
  display:flex;
  justify-content: center;
  gap:10px;
  align-items:center;
  flex-wrap: wrap;           /* wraps naturally under the title row */
}

.navlink{
  display:inline-block;
  padding:6px 10px;
  border:2px solid rgba(255,255,255,0.25);
  border-radius:10px;
  color:#fff;
  text-decoration:none;
  font-weight:800;
  font-size:13px;
  letter-spacing:0.03em;
  text-transform:uppercase;
  opacity:.85;
}
.navlink-active{
  border-color:#fff;
  opacity:1;
}

/* ---- Error banner ---- */
.feed-error{
  margin:10px 14px;
  padding:10px 12px;
  border:2px solid #c40000;
  color:#c40000;
  font-weight:700;
  background:#ffecec;
  white-space:pre-wrap;
}

/* ---- Layout wrapper ---- */
main{
  width: 100%;
  padding-bottom: var(--footer-h);
}

/* ========================================================================
   Table
   ======================================================================== */
.dash{
  width: 100%;
  max-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

/* Column Header row (STICKY under fixed topbar) */
.dash thead th{
  position: sticky;
  top: calc(var(--topbar-h) + env(safe-area-inset-top)); /* KEY CHANGE */
  z-index: 1500;

  background: linear-gradient(180deg, var(--blue) 0%, var(--blue-dark) 100%);
  color:#fff;
  text-transform:uppercase;
  letter-spacing:0.06em;
  font-weight:900;
  font-size:20px;
  padding:16px 10px;
  text-align:center;
  border-right:3px solid #000;
  border-bottom:3px solid var(--gold);
  background-clip: padding-box;
}
.dash thead th:last-child{ border-right:0; }

/* Cells */
.dash tbody td{
  padding:12px 10px;
  border-right:3px solid #000;
  border-bottom:1px solid #ddd;
  vertical-align:middle;
  background:#fff;
  font-size:18px;

  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.dash tbody tr:nth-child(even) td{ background: var(--row-alt); }
.dash tbody td:last-child{ border-right:0; }

/* Desktop widths */
.col-current { width: 360px; }
.col-status  { width: 140px; }
.col-surv    { width: 90px; }
.col-time    { width: 110px; }
.col-last    { width: 300px; }

/* Alignment */
.cell-current, .cell-last{ text-align:left; font-weight:700; }
.cell-time{ text-align:left; font-weight:800; }
.cell-status, .cell-surv{ text-align:center; font-weight:900; }

/* Status */
.cell-status.status-out{
  background: var(--out-red) !important;
  color:#fff !important;
  font-size:28px;
}
.cell-status.status-in{
  background: var(--in-green) !important;
  color:#fff !important;
  font-size:28px;
}

/* Surv */
.cell-surv.surv-s{ background: var(--surv-yellow) !important; color:#fff !important; font-size:28px; }
.cell-surv.surv-dash{ background: var(--surv-gray) !important; color:#fff !important; font-size:28px; }
.cell-surv.surv-bad{ background: var(--surv-red) !important; color:#fff !important; font-size:28px; }
.cell-surv.surv-ok{ background: var(--surv-green) !important; color:#fff !important; font-size:28px; }
.cell-surv.surv-na{ background: var(--surv-green) !important; color:#fff !important; font-size:28px; }

/* ========================================================================
   Sticky Footer
   ======================================================================== */
.footer{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;

  height: var(--footer-h);
  padding: 0 16px;

  background: rgba(247,247,247,0.96);
  border-top:2px solid #ddd;

  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;

  font-size:13px;
  font-weight:600;
  color:#555;

  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.footer-left{ white-space:nowrap; }
.footer-right{ opacity:.8; }

/* ========================================================================
   Form page
   ======================================================================== */
.formwrap{
  width:100%;
  padding-bottom: var(--footer-h);
}

.formframe{
  width:100%;
  height: calc(100vh - (var(--topbar-h) + env(safe-area-inset-top)) - var(--footer-h));
  border:0;
  display:block;
}

/* ========================================================================
   Input 2 — hollow form UI
   ======================================================================== */
.page{
  width:100%;
  padding: 14px 14px calc(var(--footer-h) + 16px);
}

.card{
  max-width: 720px;
  margin: 0 auto;
  border: 3px solid #000;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}

.card-head{
  text-align: center;
  padding: 14px 14px;
  background: #0e0e14;
  color: #fff;
  border-bottom: 3px solid #000;
}

.card-title{
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 16px;
}

.card-sub{
  margin-top: 6px;
  font-weight: 700;
  opacity: .85;
  font-size: 13px;
}

.wt-form{
  padding: 14px;
}

.grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field{
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-wide{
  grid-column: 1 / -1;
}

.label{
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 12px;
}

.control{
  width: 100%;
  border: 2px solid #000;
  border-radius: 12px;
  padding: 12px 12px;
  font-size: 16px;
  font-weight: 800;
  background: #fff;
  color: #111;
  font-family: Helvetica, Arial, "Helvetica Neue", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.control:disabled{
  background: #f2f2f2;
  color: #555;
}

.hint{
  font-size: 12px;
  font-weight: 700;
  opacity: .75;
}

.pillrow{
  display: flex;
  gap: 10px;
}

.pill{
  flex: 0 0 auto;
  padding: 10px 14px;
  border-radius: 999px;
  border: 2px solid #000;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--surv-yellow);
  color: #fff;
  font-family: Helvetica, Arial, "Helvetica Neue", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.pill-off{
  background: #8f8f8f;
}

.pill:disabled{
  opacity: .75;
}

.actions{
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.btn{
  width: 100%;
  border-radius: 12px;
  border: 2px solid #000;
  padding: 12px 14px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: Helvetica, Arial, "Helvetica Neue", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.btn-primary{
  background: linear-gradient(180deg, var(--blue) 0%, var(--blue-dark) 100%);
  color: #fff;
}

.btn-ghost{
  background: #fff;
  color: #111;
}

.btn:disabled{
  opacity: .6;
}

.note{
  margin-top: 12px;
  padding: 10px 12px;
  border: 2px dashed #999;
  border-radius: 12px;
  font-weight: 700;
  font-size: 13px;
  color:#333;
  background:#fafafa;
}

/* Segmented control (OUT / IN) */
.seg{
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}

.seg-btn{
  flex: 1;
  padding: 12px 0;
  border: 2px solid #000;
  border-radius: 12px;
  background: #fff;
  color: #111;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 14px;
  cursor: default;
  font-family: Helvetica, Arial, "Helvetica Neue", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.seg-btn:not(.seg-active){ opacity: 0.5; }

.seg-btn.seg-active{
  background: linear-gradient(180deg, var(--blue) 0%, var(--blue-dark) 100%);
  color: #fff;
  opacity: 1;
}

/* ========================================================================
   Mobile
   ======================================================================== */
@media (max-width: 720px){
  :root{
    --footer-h: var(--footer-h-mobile);

    /* KEY: fixed header is now 2 rows (row1 + nav row), so increase offset */
    --topbar-h: 104px;
  }

  .title{ font-size:18px; }
  .lastupdate{ font-size:14px; }

  .dash thead th{
    font-size:12px;
    padding:10px 4px;
    letter-spacing:0.02em;
    white-space: nowrap;
  }

  .dash tbody td{
    font-size:14px;
    padding:10px 6px;
  }

  /* FINAL mobile column widths (sum = 100%) */
  .col-current { width: 38%; }
  .col-status  { width: 16%; }
  .col-surv    { width: 11%; }
  .col-time    { width: 13%; }
  .col-last    { width: 22%; }

  /* Wrap only CURRENT + LAST */
  .dash tbody td.cell-current,
  .dash tbody td.cell-last{
    white-space: normal !important;
    text-overflow: clip !important;
    overflow: visible !important;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.15;
  }

  .cell-status.status-in,
  .cell-status.status-out,
  .cell-surv.surv-s,
  .cell-surv.surv-dash,
  .cell-surv.surv-bad,
  .cell-surv.surv-ok,
  .cell-surv.surv-na{
    font-size:20px;
  }

  main{ padding-bottom: var(--footer-h); }

  .footer{
    height: var(--footer-h);
    padding: 8px 14px;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 4px;
    font-size:12px;
  }

  /* Nav buttons slightly larger on mobile */
  .navlink{ font-size:14px; }
}

/* Input 2 — single column */
@media (max-width: 720px){
  .grid{ grid-template-columns: 1fr; }
}

/* iPhone-narrow: a little more header height safety */
@media (max-width: 480px){
  :root{
    --topbar-h: 116px;
  }

  .page{
    padding: 10px 10px calc(var(--footer-h) + 10px);
  }

  .card-head{ padding: 10px 12px; }
  .wt-form{ padding: 12px; }

  .card-title{ font-size: 13px; }
  .card-sub{ font-size: 11px; }

  .label{ font-size: 11px; }
  .control{
    padding: 10px 12px;
    font-size: 15px;
  }
  .hint{ font-size: 11px; }

  .seg{
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
  }
  .seg-btn{
    width: 100%;
    padding: 11px 0;
    font-size: 13px;
  }

  .pillrow{
    flex-direction: column;
    gap: 8px;
  }
  .pill{
    width: 100%;
    padding: 11px 0;
    text-align: center;
  }

  .actions{
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
  }
  .btn{
    width: 100%;
    padding: 11px 0;
  }

  .note{
    margin-top: 10px;
    padding: 10px 10px;
    font-size: 12px;
  }
}
/* ========================================================================
   Topbar text vertical centering + baseline fix
   Put near bottom so it overrides earlier .topbar/.topbar-row/.title rules
   ======================================================================== */

.topbar-row{
  align-items: center; /* was baseline */
}

.title{
  line-height: 1;      /* tighter vertical box */
}

.lastupdate{
  line-height: 1;      /* match title */
}
/* ========================================================================
   Login page background (burnt orange)
   ======================================================================== */


body.login{
  background:
    radial-gradient(
      circle at 40% 30%,
      #f3c18f 0%,
      #e79a57 45%,
      #c96a2d 100%
    );
}

/* Optional: slightly lift the card off the warm background */
body.login .card{
  box-shadow: 0 12px 30px rgba(0,0,0,0.18);
}
/* ========================================================================
   Login page — center card in remaining viewport (below topbar, above footer)
   ======================================================================== */

.login-main{
  min-height: calc(100vh - var(--topbar-h) - var(--footer-h));
  display: flex;
  align-items: center;      /* vertical center */
  justify-content: center;  /* horizontal center */
  padding: 24px 14px calc(var(--footer-h) + 18px);
}

.login-card{
  width: 100%;
  max-width: 680px;
}
/* Shake animation */
@keyframes wt-shake {
  0%, 100% { transform: translateX(0); }
  15%      { transform: translateX(-10px); }
  30%      { transform: translateX(10px); }
  45%      { transform: translateX(-8px); }
  60%      { transform: translateX(8px); }
  75%      { transform: translateX(-4px); }
  90%      { transform: translateX(4px); }
}

/* Apply shake to the card when class is added */
.card.is-shaking {
  animation: wt-shake 320ms ease-in-out;
}

/* ========================================================================
   Future Input page (futureinput.html) — Knicks hints + centered card
   ======================================================================== */

/* Knicks-ish orange (used on login); tweak here if you want warmer/cooler */
:root{
  --knicks-orange: #f26a21;
  --knicks-orange-dark: #c84f12;
}

/* Blue radial background for future input page */
body.future{
  background:
    radial-gradient(
      circle at center,
      #ffffff 0%,
      rgba(36, 59, 255, 0.18) 5%,
      rgba(24, 40, 184, 0.685) 62%,
      rgba(24, 40, 184, 0.835) 100%
    );
}

/* Center the card in the remaining viewport (below topbar, above footer) */
.future-main{
  min-height: calc(100vh - var(--topbar-h) - var(--footer-h));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 14px calc(var(--footer-h) + 18px);
}

/* Make sure the card doesn't shrink weirdly when centered */
body.future .card{
  width: 100%;
  max-width: 720px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.14);
}

/* Orange primary button ONLY on future input page */
body.future .btn-primary{
  background: linear-gradient(180deg, var(--knicks-orange) 0%, var(--knicks-orange-dark) 100%);
  color: #fff;
}

/* Optional: give the segmented active state the same orange treatment */
body.future .seg-btn.seg-active{
  background: linear-gradient(180deg, var(--knicks-orange) 0%, var(--knicks-orange-dark) 100%);
  color: #fff;
}