/* Narwhal's Crafted — In-House Reservations
   All brand values come from brand-spec.md (single source of truth).
   Primary target device: iPad (landscape 1024–1366px, portrait 768–1024px).
   Touch targets are kept ≥44px and nothing depends on hover to function. */

/* ---------- fonts (self-hosted copies of the brand webfonts) ---------- */
@font-face {
  font-family: "kisnaregular";
  src: url("/webfonts/kisna-regular-webfont.woff2") format("woff2"),
       url("/webfonts/kisna-regular-webfont.woff") format("woff");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "tay_sweetheartregular";
  src: url("/webfonts/taysweetheart-webfont.woff2") format("woff2"),
       url("/webfonts/taysweetheart-webfont.woff") format("woff");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ---------- tokens (brand-spec.md §11) ---------- */
:root {
  /* color — verified */
  --ink:   #093543;
  --deep:  #06495e;
  --navy:  #204a5e;
  --cyan:  #40b9d0;
  --slate: #598c9f;
  --foam:  #fef6f6;
  --red:   #ef4440;   /* universal hover / alert */
  --beige: #F0E6E6;

  /* color — internal derived */
  --cyan-tint: #e3f3f7;
  --cyan-dim:  #2a98ae;
  --line: rgba(9, 53, 67, .14);
  --text-main:  #0d2a35;
  --text-muted: #4a6870;

  /* seasonal green for success states (brand-spec §1) */
  --green: #0eaa4e;
  /* fall orange for SEATED reservation status */
  --orange: #e18326;
  /* Mardi Gras gold (brand-spec §1) for the turn-time warning window */
  --gold: #CD9B06;

  /* type — production names */
  --font-title:  "kisnaregular", "Arial Rounded MT Bold", sans-serif;
  --font-accent: "tay_sweetheartregular", "Brush Script MT", cursive;
  --font-body:   acumin-variable, "DM Sans", system-ui, sans-serif;
  --font-mono:   "DM Mono", ui-monospace, monospace;

  /* layout — verified */
  --radius-btn: 0.25rem;
  --radius-card: 6px;
  --shadow-btn: 0 0.625rem 1.25rem rgba(0, 0, 0, .15);
  --shadow-card: 0 0.625rem 1rem rgba(0, 0, 0, .05);

  /* layout — this app */
  --panel-w: 340px;          /* reservation list panel on the floor view */
  --touch: 44px;             /* minimum touch target */
}

/* ---------- base ---------- */
* { box-sizing: border-box; }

html { font-size: 16px; }

body {
  margin: 0;
  background: var(--foam) url("/img/bkg_tex.png") repeat;
  color: var(--text-main);
  font-family: var(--font-body);
  font-weight: 300;
  font-variation-settings: "slnt" 0, "wdth" 67.5, "wght" 300;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4 {
  font-family: var(--font-title);
  font-weight: normal;
  color: var(--navy);
  margin: 0 0 .5rem;
  line-height: 1.15;
}
h1 { font-size: 2.3125rem; letter-spacing: .095rem; }   /* fs-700 */
h2 { font-size: 1.875rem;  letter-spacing: .034rem; }   /* fs-550 */
h3 { font-size: 1.375rem;  letter-spacing: .0275rem; }  /* fs-485 */
h4 { font-size: 1.25rem;   letter-spacing: .07rem; }    /* fs-450 */

p { margin: 0 0 1rem; letter-spacing: .02em; }

a { color: var(--cyan); text-decoration: none; }
a:hover { color: var(--red); }

strong, b { font-weight: 500; }

:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0s !important;
    transition-duration: 0s !important;
  }
}

/* ---------- buttons (4px radius, float shadow, NO hover transition) ---------- */
.btn {
  display: inline-block;
  font-family: var(--font-title);
  font-size: 1.0625rem;
  letter-spacing: .07rem;
  min-height: var(--touch);
  padding: .75rem 1.25rem;
  border: none;
  border-radius: var(--radius-btn);
  background: var(--navy);
  color: var(--foam);
  cursor: pointer;
  box-shadow: var(--shadow-btn);
  transition: none;
  text-align: center;
}
.btn:hover { background: var(--red); color: var(--foam); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-cyan { background: var(--cyan); color: var(--ink); }
.btn-cyan:hover { background: var(--red); color: var(--foam); }

.btn-ghost {
  background: transparent;
  color: var(--navy);
  border: 1px solid var(--slate);
  box-shadow: none;
}
.btn-ghost:hover { background: transparent; color: var(--red); border-color: var(--red); }

.btn-danger { background: var(--red); }
.btn-danger:hover { background: var(--ink); }

.btn-small { font-size: .9rem; padding: .5rem .8rem; min-height: 40px; }

/* ---------- forms ---------- */
label { display: block; font-size: .875rem; color: var(--text-muted); margin-bottom: .25rem; }

input[type="text"], input[type="password"], input[type="tel"], input[type="number"],
input[type="date"], input[type="time"], select, textarea {
  width: 100%;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1rem;
  color: var(--text-main);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-btn);
  padding: .6rem .7rem;
  min-height: var(--touch);
  margin-bottom: .9rem;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-tint);
}
textarea { min-height: 5rem; resize: vertical; }

.field-row { display: flex; gap: .75rem; }
.field-row > * { flex: 1; min-width: 0; }

.form-error {
  background: #fdecec;
  border: 1px solid var(--red);
  border-radius: var(--radius-btn);
  color: var(--red);
  font-weight: 400;
  font-size: .9rem;
  padding: .5rem .75rem;
  margin-bottom: 1rem;
}
.form-error:empty { display: none; }

/* ---------- header ---------- */
.app-header {
  display: flex;
  align-items: center;
  gap: .9rem;
  background: var(--navy);
  color: var(--foam);
  padding: .5rem 1.25rem;
  min-height: 58px;
}
.app-header img.logo { height: 40px; filter: drop-shadow(0 0 .625rem rgba(0, 0, 0, .15)); }
.app-header .app-title {
  font-family: var(--font-title);
  font-size: 1.375rem;
  letter-spacing: .0275rem;
  color: var(--foam);
  margin: 0;
}
.app-header .spacer { flex: 1; }
.app-header .whoami { font-size: .875rem; color: var(--cyan-tint); }
.app-header .btn-small { box-shadow: none; }

/* ---------- page shells ---------- */
body.app-page, body.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
body.app-page .app-body { flex: 1; display: flex; min-height: 0; }
body.login-page .login-wrap { flex: 1; min-height: 0; }

/* ---------- login page ---------- */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-btn);
  padding: 2.25rem 2rem;
  text-align: center;
}
.login-card img.logo { height: 84px; margin-bottom: .75rem; }
.login-card h1 { font-size: 1.875rem; letter-spacing: .034rem; }
.login-tagline {
  font-family: var(--font-accent);
  color: var(--slate);
  font-size: 1.35rem;
  margin: -.25rem 0 1.5rem;
}
.login-card form { text-align: left; }
.login-card .btn { width: 100%; margin-top: .25rem; }

/* ---------- footer ---------- */
.site-foot {
  margin-top: auto;
  padding-top: 56px;
  background: url("/img/wave_section_break-navy-flip.svg") center top no-repeat;
}
@media screen and (min-width: 1400px) {
  .site-foot { background-size: 100% 59px; }
}
.foot-band {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .25rem 1.5rem;
  background: var(--navy);
  color: var(--foam);
  padding: .1rem 1.25rem .9rem;
}
.foot-narly { font-family: var(--font-accent); font-size: 1.55rem; color: var(--cyan); }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 73, 94, .5);   /* brand deep-teal scrim */
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 3rem 1rem 2rem;
  overflow-y: auto;
  z-index: 50;
}
.modal {
  position: relative;
  width: 100%;
  max-width: 560px;
  background: #fff;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-btn);
  padding: 1.5rem 1.75rem;
}
.modal-close {
  position: absolute;
  top: .5rem;
  right: .5rem;
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--slate);
  cursor: pointer;
  padding: .5rem .6rem;   /* generous touch target */
}
.modal-close:hover { color: var(--red); }
.modal h2 { margin-bottom: 1rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1rem; flex-wrap: wrap; }
.modal-actions .push-left { margin-right: auto; }
.hidden { display: none !important; }

/* ---------- floor view: plan + reservations panel ---------- */
.floor-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: .9rem;
  gap: .75rem;
}
.floor-toolbar {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}
.floor-toolbar .date-nav { display: flex; align-items: center; gap: .35rem; }
.floor-toolbar input[type="date"] { margin-bottom: 0; width: auto; }
.floor-toolbar .spacer { flex: 1; }

/* the plan area — blueprint image with tables absolutely positioned on top */
.plan-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.plan-surface {
  position: absolute;
  touch-action: none;      /* pointer events handle drag; no page scroll fights */
  background: #fff center / contain no-repeat;
}
/* no blueprint uploaded yet: subtle grid so table placement still reads */
.plan-surface.no-blueprint {
  background-image:
    linear-gradient(var(--cyan-tint) 1px, transparent 1px),
    linear-gradient(90deg, var(--cyan-tint) 1px, transparent 1px);
  background-size: 40px 40px;
}
.plan-empty-hint {
  position: absolute;
  inset: auto 0 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: .9rem;
  pointer-events: none;
}

.floor-table {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--cyan-tint);
  border: 2px solid var(--slate);
  color: var(--navy);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  min-width: 34px;
  min-height: 34px;
}
.floor-table.round { border-radius: 50%; }
.floor-table.rect { border-radius: var(--radius-card); }
.floor-table .t-label {
  font-family: var(--font-title);
  font-size: .95rem;
  letter-spacing: .02rem;
  line-height: 1.1;
  text-align: center;
  padding: 0 .2rem;
}
.floor-table .t-seats { font-size: .7rem; color: var(--text-muted); line-height: 1; }

/* status coloring: booked reservation on the viewed day, or a live seating
   clock (green = fine, gold = warning window, red = time's up) */
.floor-table.has-booking { border-color: var(--cyan-dim); background: #d7f0f6; }
.floor-table.seat-ok   { border-color: var(--green); background: #d9f3e4; }
.floor-table.seat-warn { border-color: var(--gold);  background: #f8ecc8; }
.floor-table.seat-over { border-color: var(--red);   background: #fddede; }
.floor-table.seat-ok .t-seats,
.floor-table.seat-warn .t-seats,
.floor-table.seat-over .t-seats {
  font-family: var(--font-mono);
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-main);
}
.floor-table.seat-over .t-seats { color: var(--red); }
.floor-table.selected {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(239, 68, 64, .25);
  z-index: 5;
}

/* edit mode affordances */
.plan-wrap.editing { outline: 3px dashed var(--cyan); outline-offset: -3px; }
.plan-wrap.editing .floor-table { cursor: grab; }
.plan-wrap.editing .floor-table:active { cursor: grabbing; }
.resize-handle {
  position: absolute;
  right: -10px;
  bottom: -10px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--cyan);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
  touch-action: none;
}

/* reservations side panel */
.res-panel {
  width: var(--panel-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-left: 3px solid var(--cyan);
  background: rgba(255, 255, 255, .55);
  min-height: 0;
}
.res-panel-head {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .9rem 1rem .5rem;
}
.res-panel-head h2 { margin: 0; font-size: 1.25rem; flex: 1; }
.res-list { flex: 1; overflow-y: auto; margin: 0; padding: 0 1rem 1rem; list-style: none; }
.res-empty { color: var(--text-muted); font-size: .9rem; padding: .5rem 0; }

.res-card {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--cyan);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: .6rem .75rem;
  margin-bottom: .6rem;
  cursor: pointer;
}
.res-card .res-top { display: flex; align-items: baseline; gap: .5rem; }
.res-card .res-time { font-family: var(--font-title); font-size: 1.05rem; color: var(--deep); }
.res-card .res-name { font-weight: 400; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-card .res-meta { font-size: .85rem; color: var(--text-muted); }
.res-card.status-SEATED { border-left-color: var(--orange); }
.res-card.status-FINISHED { border-left-color: var(--green); opacity: .65; }
.res-card.status-CANCELLED, .res-card.status-NO_SHOW { border-left-color: var(--slate); opacity: .5; }
.res-card.status-CANCELLED .res-name, .res-card.status-NO_SHOW .res-name { text-decoration: line-through; }

.status-pill {
  display: inline-block;
  font-size: .7rem;
  font-weight: 400;
  letter-spacing: .05em;
  border-radius: 1rem;
  padding: .1rem .5rem;
  background: var(--beige);
  color: var(--navy);
}
.status-pill.SEATED { background: #fdeeda; color: var(--orange); }
.status-pill.FINISHED { background: #e2f6ea; color: var(--green); }
.status-pill.CANCELLED, .status-pill.NO_SHOW { background: var(--beige); color: var(--text-muted); }

/* quick status buttons inside the reservation modal */
.status-row { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .9rem; }
.status-row .btn-small.active { background: var(--cyan); color: var(--ink); }

/* ---------- 7-day calendar bar ---------- */
.cal-bar { display: flex; gap: .4rem; align-items: stretch; flex-wrap: wrap; }
.cal-day {
  min-width: 64px;
  min-height: var(--touch);
  padding: .3rem .5rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  cursor: pointer;
  text-align: center;
  font-family: var(--font-body);
  color: var(--text-main);
  position: relative;
}
.cal-day .cal-dow {
  display: block;
  font-family: var(--font-title);
  font-size: .8rem;
  letter-spacing: .05rem;
  color: var(--slate);
  text-transform: uppercase;
}
.cal-day .cal-num { display: block; font-size: 1.05rem; font-weight: 400; line-height: 1.2; }
.cal-day:hover { border-color: var(--red); }
.cal-day.active { border-color: var(--cyan); background: var(--cyan-tint); }
.cal-day.active .cal-dow { color: var(--deep); }
/* a day with pre-booked reservations gets a badge so the week ahead reads at a glance */
.cal-day.has-booked { border-color: var(--cyan-dim); }
.cal-day .cal-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  font-size: .75rem;
  font-weight: 500;
  line-height: 20px;
}

/* ---------- party-size picker (seat modal) ---------- */
.size-row { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.size-row button {
  width: var(--touch);
  height: var(--touch);
  font-family: var(--font-title);
  font-size: 1.15rem;
  background: #fff;
  border: 1px solid var(--slate);
  border-radius: var(--radius-btn);
  color: var(--navy);
  cursor: pointer;
}
.size-row button.active { background: var(--navy); color: var(--foam); border-color: var(--navy); }

/* seated-party summary block in the table modal */
.seat-info {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  background: var(--foam);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: .75rem 1rem;
  margin-bottom: 1rem;
}
.seat-info .seat-clock { font-family: var(--font-mono); font-size: 1.6rem; color: var(--green); }
.seat-info.warn .seat-clock { color: var(--gold); }
.seat-info.over .seat-clock { color: var(--red); }

/* table editor fields (edit mode side sheet) */
.table-props {
  background: var(--foam);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 1rem 1rem .25rem;
  margin-bottom: .9rem;
}

/* ---------- admin page ---------- */
.tabs {
  display: flex;
  gap: .25rem;
  padding: 0 1.25rem;
  background: var(--deep);
}
.tabs button {
  font-family: var(--font-title);
  font-size: 1.05rem;
  letter-spacing: .034rem;
  background: none;
  border: none;
  color: var(--cyan-tint);
  padding: .8rem 1.1rem;
  min-height: var(--touch);
  cursor: pointer;
  border-bottom: 3px solid transparent;
}
.tabs button:hover { color: var(--red); }
.tabs button.active { color: #fff; border-bottom-color: var(--cyan); }

main.content { flex: 1; padding: 1.5rem 1.5rem 4rem; max-width: 900px; }

.admin-list { list-style: none; margin: 0 0 .75rem; padding: 0; }
.admin-list li {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: .65rem .9rem;
  margin-bottom: .55rem;
  min-height: var(--touch);
}
.admin-list .grow { flex: 1; min-width: 0; }
.admin-list .item-title { font-family: var(--font-title); font-size: 1.1rem; color: var(--navy); }
.admin-list .item-sub { font-size: .85rem; color: var(--text-muted); }
.admin-list .actions { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ---------- iPad portrait: stack the panel under the plan ---------- */
@media (max-width: 900px) {
  .app-body { flex-direction: column; }
  .res-panel {
    width: auto;
    border-left: none;
    border-top: 3px solid var(--cyan);
    max-height: 40vh;
  }
  .floor-main { min-height: 55vh; }
}
