/* ============================================================
   BipPark – Parking Reservation PWA
   Infobip brand identity: orange #FF4B00 · dark gray #36393B · white
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ── Bepo Sunrise design tokens ── */

  /* Accent (colorBackgroundAccent / colorTextAccent) */
  --ib-orange:      #fc6423;
  --ib-orange-dark: #d1521c;
  --ib-orange-pale: #fff5eb;   /* colorBackgroundAccentSubdued */

  /* Header / inverse surface (colorBackgroundPrimaryInverse) */
  --ib-gray:        #23252a;
  --ib-gray-mid:    #545452;   /* colorTextSecondary */
  --ib-gray-light:  #a6a5a2;   /* colorTextSubdued */
  --ib-gray-pale:   #e5e5e3;   /* colorBackgroundTertiary */
  --ib-white:       #ffffff;

  /* Primary interactive — teal (colorButtonBackgroundPrimary) */
  --interactive:        #2D7595;
  --interactive-hover:  #0d516e;
  --interactive-active: #074058;
  --interactive-pale:   #f0f9fc;

  /* ── Semantic tokens ── */
  --bg:             #f4f4f2;   /* colorBackgroundSecondary */
  --surface:        #ffffff;   /* colorBackgroundPrimary */
  --surface2:       #e5e5e3;   /* colorBackgroundTertiary */
  --border:         #d9d8d7;   /* colorBorderPrimary */
  --text:           #1b1b1a;   /* colorTextPrimary */
  --text-muted:     #545452;   /* colorTextSecondary */
  --text-dim:       #a6a5a2;   /* colorTextSubdued */

  /* ── State colors ── */
  --free:           #208560;   /* colorBackgroundSuccess */
  --free-bg:        #ebf5f1;   /* colorBackgroundSuccessSubdued */
  --free-border:    #a6e0c9;   /* colorBackgroundSuccessModerate */
  --occupied:       #fc6423;   /* colorTextAccent */
  --occupied-bg:    #fff5eb;   /* colorBackgroundAccentSubdued */
  --occupied-border:#ffe4cc;   /* colorBorderAccentSubdued */

  /* ── Geometry (Bepo borderRadiusDefault = 2px) ── */
  --radius:         12px;
  --radius-sm:      8px;
  --header-h:       56px;
  --safe-top:       env(safe-area-inset-top, 0px);
  --safe-bottom:    env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: InterVariable, 'Inter Variable', Inter, 'Helvetica Neue', Helvetica, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ── App Shell ─────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  height: 100dvh;
}

/* ── Header ────────────────────────────────── */
#app-header {
  background: var(--ib-gray);
  height: calc(var(--header-h) + var(--safe-top));
  padding-top: var(--safe-top);
  display: flex;
  align-items: center;
  padding-left: 16px;
  padding-right: 16px;
  gap: 12px;
  flex-shrink: 0;
}

/* Logo + wordmark lockup */
.app-logo-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Orange rounded-square logo */
.ib-icon {
  width: 36px;
  height: 36px;
  background: var(--ib-orange);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.ib-icon-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Two-line wordmark */
.app-wordmark {
  display: flex;
  flex-direction: column;
  gap: 0;
  line-height: 1;
}
.app-wordmark-row1 {
  display: flex;
  align-items: baseline;
  gap: 0;
}
.app-wordmark-bip {
  font-size: 18px;
  font-weight: 400;
  color: rgba(255,255,255,0.85);
  letter-spacing: -0.3px;
}
.app-wordmark-park {
  font-size: 18px;
  font-weight: 800;
  color: var(--ib-white);
  letter-spacing: -0.3px;
}
.app-wordmark-city {
  font-size: 10px;
  font-weight: 500;
  color: var(--ib-orange);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 1px;
}

.header-spacer { flex: 1; }

#today-btn {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid rgba(255,255,255,0.25);
  background: transparent;
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.2px;
}
#today-btn:hover {
  border-color: var(--interactive);
  color: var(--interactive);
}

/* ── Tab bar ────────────────────────────────── */
#tab-bar {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  background: var(--ib-gray);
  flex-shrink: 0;
}
.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.55);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.tab-btn:hover {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.85);
}
.tab-btn.active {
  background: var(--ib-orange);
  color: #fff;
}
.tab-icon {
  font-size: 16px;
  line-height: 1;
}

/* ── Tab panels ─────────────────────────────── */
.tab-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}
.tab-panel--hidden {
  display: none;
}

/* Empty state for panels not yet built */
.empty-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-dim);
  padding: 40px 24px;
}
.empty-panel svg {
  opacity: 0.35;
}
.empty-panel p {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0;
}
.empty-panel span {
  font-size: 13px;
  color: var(--text-dim);
}

/* ── Calendar Strip ─────────────────────────── */
#calendar-section {
  background: var(--ib-white);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 10px;
}

#calendar-middle {
  flex: 1;
  min-width: 0;
}

#calendar-date-row {
  display: flex;
  align-items: center;
  padding: 8px 4px 2px;
}

#date-label {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.nav-arrow {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface2);
  color: var(--text-muted);
  font-size: 17px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
  line-height: 1;
}
.nav-arrow:hover { border-color: var(--interactive); color: var(--interactive); }

#calendar-strip {
  display: flex;
  gap: 2px;
  padding: 4px 0 10px;
  justify-content: center;
  overflow-x: auto;
  scrollbar-width: none;
}
#calendar-strip::-webkit-scrollbar { display: none; }

.day-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 44px;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.day-btn:hover { background: var(--surface2); color: var(--text); }
.day-btn.today .day-num { color: var(--ib-orange); font-weight: 800; }
.day-btn.weekend { opacity: 0.45; }
.day-btn.active {
  background: var(--ib-orange);
  border-color: var(--ib-orange);
  color: #fff;
}
.day-btn.active .day-name,
.day-btn.active .day-num,
.day-btn.active .day-month { color: #fff; }

.day-name  { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.day-num   { font-size: 19px; font-weight: 700; line-height: 1.1; }
.day-month { font-size: 9px; opacity: 0.8; }

/* ── Main scrollable area ───────────────────── */
#app-main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 14px 12px;
  padding-bottom: calc(14px + var(--safe-bottom));
}

/* ── Summary bar ────────────────────────────── */
#summary-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

#summary {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--ib-white);
  border: 1px solid var(--border);
  padding: 4px 16px;
  border-radius: 20px;
}

/* ── Floor Plan Container ───────────────────── */
#floor-plan {
  max-width: 640px;
  margin: 0 auto;
}

/* ── Scroll hint ────────────────────────────── */
.scroll-hint {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.3px;
  padding: 0 0 8px;
  opacity: 1;
  transition: opacity 0.6s;
}
.scroll-hint-hide { opacity: 0; }

/* ── Scroll fade wrapper ────────────────────── */
/* The wrapper sits around the scrollable element and carries
   ::before (left fade) and ::after (right fade) overlays.
   JS toggles .fade-left / .fade-right on this element.       */
.plan-scroller-wrap {
  position: relative;
  border-radius: var(--radius);
  /* clip the pseudo-element fades to the rounded corners */
  overflow: hidden;
}

.plan-scroller-wrap::before,
.plan-scroller-wrap::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 56px;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.25s ease;
}
/* Left fade — background colour matches --bg so it blends in */
.plan-scroller-wrap::before {
  left: 0;
  background: linear-gradient(to right, var(--bg) 0%, transparent 100%);
}
/* Right fade */
.plan-scroller-wrap::after {
  right: 0;
  background: linear-gradient(to left, var(--bg) 0%, transparent 100%);
}

.plan-scroller-wrap.fade-left::before  { opacity: 1; }
.plan-scroller-wrap.fade-right::after  { opacity: 1; }

/* ── Actual scrollable element ──────────────── */
.plan-scroller {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  /* no border-radius here — wrapper clips it */
  padding-bottom: 4px;
}

/* ── Shared CSS Grid for both parking rows ──── *
 *  Columns: 1-3 = group1, 4 = aisle, 5-7 = group2, 8 = aisle, 9-11 = group3
 *  Rows:    1 = Row A spots, 2 = drive lane, 3 = Row B spots
 * ─────────────────────────────────────────── */
.plan-grid {
  display: grid;
  /*                  grp1          aisle     grp2          aisle     grp3      */
  grid-template-columns: repeat(3,1fr) 20px repeat(3,1fr) 20px repeat(3,1fr);
  grid-template-rows: auto auto auto;
  /* column-gap spreads between all columns incl. aisles; row-gap for drive lane spacing */
  column-gap: 0;
  row-gap: 0;
  background: var(--ib-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  /* min-width: spot columns 9 × 60px + aisles 2 × 20px + padding 20px = 600px */
  min-width: 600px;
}

/* ── Spot card ──────────────────────────────── */
.spot-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 10px 3px 9px;
  /* Use inset margin so every card fills 100% of its grid cell minus 3px all around.
     This guarantees identical card width in Row A and Row B. */
  margin: 3px;
  /* Explicitly fill the grid cell width */
  box-sizing: border-box;
  border-radius: var(--radius-sm);
  border: 1.5px solid;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  position: relative;
  min-height: 82px;
  /* prevent button from shrinking below grid cell */
  width: calc(100% - 6px);
  align-self: stretch;
}
.spot-card.free {
  background: var(--free-bg);
  border-color: var(--free-border);
}
.spot-card.occupied {
  background: var(--occupied-bg);
  border-color: var(--occupied-border);
}
.spot-card:active { transform: scale(0.93); }
.spot-card:hover  { box-shadow: 0 2px 10px rgba(0,0,0,0.10); transform: translateY(-1px); }

.spot-num {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.spot-card.free     .spot-num { color: var(--free); }
.spot-card.occupied .spot-num { color: var(--ib-orange-dark); }

.spot-name {
  font-size: 10px;
  text-align: center;
  line-height: 1.25;
  min-height: 20px;
  word-break: break-word;
  padding: 0 3px;
}
.spot-card.free     .spot-name { color: var(--free); opacity: 0.55; }
.spot-card.occupied .spot-name { color: var(--ib-orange-dark); font-weight: 500; }

.spot-team {
  display: block;
  font-size: 8px;
  font-weight: 400;
  opacity: 0.7;
  margin-top: 1px;
  letter-spacing: 0;
}

/* Free spot checkmark icon */
.spot-card.free::after {
  content: '✓';
  font-size: 13px;
  font-weight: 700;
  color: var(--free);
  opacity: 0.5;
}
.spot-card.occupied::after { content: ''; }

/* Template (permanent) spot — small pin badge in top-right corner */
.spot-card.template::before {
  content: '📌';
  position: absolute;
  top: 3px;
  right: 4px;
  font-size: 9px;
  line-height: 1;
  opacity: 0.6;
}

/* Entrance area (Row B center, cols 5-7 spanned) */
.spot-entrance {
  grid-column: 5 / 8;
  margin: 3px;
  box-sizing: border-box;
  border-radius: var(--radius-sm);
  background: repeating-linear-gradient(
    -45deg,
    var(--ib-gray-pale) 0px,
    var(--ib-gray-pale) 6px,
    #e8eaec 6px,
    #e8eaec 12px
  );
  border: 1.5px dashed var(--border);
  min-height: 82px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  opacity: 0.7;
}
.entrance-icon {
  width: 18px;
  height: 18px;
  color: var(--text-dim);
}
.spot-entrance span {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
}

/* ── Drive Lane ─────────────────────────────── */
.drive-lane {
  grid-column: 1 / -1;
  grid-row: 2;
  background: var(--ib-gray-pale);
  border-top: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 10px;
  margin: 8px 0;
}
.lane-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  text-transform: uppercase;
  white-space: nowrap;
}
.lane-arrow-svg {
  width: 16px;
  height: 16px;
  color: var(--text-dim);
  flex-shrink: 0;
}
.lane-arrow-svg.flip { transform: scaleX(-1); }

/* ── Modal ──────────────────────────────────── */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(54,57,59,0.45);
  backdrop-filter: blur(3px);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s;
}
.modal-visible { opacity: 1 !important; pointer-events: auto !important; }

#modal {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--ib-white);
  border-top: 3px solid var(--ib-orange);
  border-radius: 18px 18px 0 0;
  z-index: 101;
  transform: translateY(100%);
  /* visibility hides the element fully after slide-out (0s delay = instant on open, 0.3s delay = after close animation) */
  visibility: hidden;
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1),
              visibility 0s linear 0.3s;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-bottom);
}
#modal.open {
  transform: translateY(0);
  visibility: visible;
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1),
              visibility 0s linear 0s;
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 10px auto 0;
  flex-shrink: 0;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  padding: 12px 16px 10px;
  gap: 10px;
  flex-shrink: 0;
}
.modal-title-block { flex: 1; }

#modal-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--ib-gray);
  letter-spacing: -0.5px;
}
#modal-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

#modal-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface2);
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  transition: all 0.15s;
}
#modal-close:hover { border-color: var(--interactive); color: var(--interactive); }

#clear-btn {
  margin: 0 16px 10px;
  padding: 10px 16px;
  background: var(--occupied-bg);
  border: 1.5px solid var(--occupied-border);
  color: var(--ib-orange-dark);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
#clear-btn:hover { background: #FFE0D6; border-color: var(--ib-orange); }

.search-wrap {
  padding: 0 16px 8px;
  flex-shrink: 0;
}
#name-search {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s;
}
#name-search:focus { border-color: var(--interactive); }
#name-search::placeholder { color: var(--text-dim); }

.user-list-label {
  padding: 0 16px 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  flex-shrink: 0;
}

#user-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  padding: 0 8px 8px;
}

.user-item {
  display: flex;
  align-items: center;
  padding: 10px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.1s;
  gap: 8px;
}
.user-item:hover, .user-item:active { background: var(--surface2); }
.user-item.current {
  background: var(--ib-orange-pale);
  border-left: 3px solid var(--ib-orange);
  padding-left: 7px;
}
.user-item.current .user-name { color: var(--ib-orange-dark); font-weight: 600; }

.user-name { font-size: 15px; flex: 1; color: var(--text); }
.user-team { font-size: 11px; font-weight: 400; color: var(--text-muted); margin-left: 5px; }

.user-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--occupied-bg);
  border: 1px solid var(--occupied-border);
  color: var(--ib-orange-dark);
}

.user-item--taken {
  opacity: 0.45;
  cursor: not-allowed;
}
.user-item--taken:hover,
.user-item--taken:active { background: transparent; }
.user-item--taken .user-name { color: var(--text-muted); }

.user-badge--taken {
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text-dim);
  font-weight: 500;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}
.user-item--shake {
  animation: shake 0.35s ease;
}

.no-results {
  padding: 24px;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
}

/* ── Reference floor plan ───────────────────── */
#reference-plan {
  max-width: 640px;
  margin: 16px auto 0;
  background: var(--ib-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.reference-plan-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  margin-bottom: 8px;
  padding-left: 2px;
}

#reference-plan-img {
  width: 100%;
  border-radius: var(--radius-sm);
  display: block;
}

/* ── Pull to refresh ────────────────────────── */
.ptr-indicator {
  height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ib-orange);
  flex-shrink: 0;
}
.ptr-indicator .ptr-arrow {
  transition: transform 0.1s ease, color 0.2s ease;
  will-change: transform;
}
.ptr-indicator.ptr-ready {
  color: var(--free);
}
.ptr-indicator.ptr-loading .ptr-arrow {
  animation: ptr-spin 0.7s linear infinite;
}
@keyframes ptr-spin {
  to { transform: rotate(360deg); }
}

/* ── Toast notification ─────────────────────── */
#toast {
  position: fixed;
  bottom: calc(24px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--free);
  color: var(--ib-white);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: 20px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1000;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Desk main scrollable area ──────────────── */
#desk-main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 14px 12px;
  padding-bottom: calc(14px + var(--safe-bottom));
}

/* ── Desk summary bar ───────────────────────── */
#desk-summary-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}
#desk-summary {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--ib-white);
  border: 1px solid var(--border);
  padding: 4px 16px;
  border-radius: 20px;
}

/* ── Desk plan container ────────────────────── */
#desk-plan {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 760px;
  margin: 0 auto;
}

/* ── Wing section ───────────────────────────── */
.desk-wing {
  background: var(--ib-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.desk-wing-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  padding: 10px 14px 6px;
  background: var(--ib-white);
  border-bottom: 1px solid var(--border);
}

/* ── Desk scroller ──────────────────────────── */
.desk-scroller-wrap {
  position: relative;
  overflow: hidden;
}
.desk-scroller-wrap::before,
.desk-scroller-wrap::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40px;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.desk-scroller-wrap::before {
  left: 0;
  background: linear-gradient(to right, var(--ib-white) 0%, transparent 100%);
}
.desk-scroller-wrap::after {
  right: 0;
  background: linear-gradient(to left, var(--ib-white) 0%, transparent 100%);
}
.desk-scroller-wrap.fade-left::before  { opacity: 1; }
.desk-scroller-wrap.fade-right::after  { opacity: 1; }

.desk-scroller {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  padding: 10px;
}
.desk-scroller::-webkit-scrollbar { display: none; }

/* ── Desk grid ──────────────────────────────── */
.desk-grid {
  display: grid;
  /* grid-template-columns set inline by JS based on wing layout */
  gap: 0;
}

/* ── Desk card ──────────────────────────────── */
.desk-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 4px 7px;
  margin: 3px;
  border-radius: var(--radius-sm);
  border: 1.5px solid;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  position: relative;
  min-height: 72px;
  width: calc(100% - 6px);
  box-sizing: border-box;
  align-self: stretch;
}
.desk-card.free {
  background: var(--free-bg);
  border-color: var(--free-border);
}
.desk-card.free.standing {
  background: var(--interactive-pale);
  border-color: #a8d4e6;
}
.desk-card.occupied {
  background: var(--occupied-bg);
  border-color: var(--occupied-border);
}
.desk-card:active { transform: scale(0.93); }
.desk-card:hover  { box-shadow: 0 2px 10px rgba(0,0,0,0.10); transform: translateY(-1px); }

.desk-num {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0px;
}
.desk-card.free              .desk-num { color: var(--free); }
.desk-card.free.standing     .desk-num { color: var(--interactive); }
.desk-card.occupied          .desk-num { color: var(--ib-orange-dark); }

.desk-name {
  font-size: 9px;
  text-align: center;
  line-height: 1.25;
  min-height: 18px;
  word-break: break-word;
  padding: 0 2px;
}
.desk-card.free              .desk-name { color: var(--free); opacity: 0.55; }
.desk-card.free.standing     .desk-name { color: var(--interactive); opacity: 0.55; }
.desk-card.occupied          .desk-name { color: var(--ib-orange-dark); font-weight: 500; }

/* Free desk checkmark */
.desk-card.free::after {
  content: '✓';
  font-size: 11px;
  font-weight: 700;
  color: var(--free);
  opacity: 0.5;
}
.desk-card.free.standing::after {
  color: var(--interactive);
}
.desk-card.occupied::after { content: ''; }

/* Template (permanent) desk — pin badge */
.desk-card.template::before {
  content: '📌';
  position: absolute;
  top: 2px;
  right: 3px;
  font-size: 8px;
  line-height: 1;
  opacity: 0.6;
}

/* Standing desk badge (bottom-left) */
.desk-standing-badge {
  position: absolute;
  bottom: 3px;
  left: 4px;
  font-size: 9px;
  font-weight: 700;
  color: var(--interactive);
  opacity: 0.75;
  line-height: 1;
}

/* Empty cell (walkway / no desk) */
.desk-cell--empty {
  margin: 3px;
  border-radius: var(--radius-sm);
  min-height: 72px;
}

/* Structural pillar */
.desk-cell--pillar {
  margin: 3px;
  border-radius: 4px;
  min-height: 72px;
  background: repeating-linear-gradient(
    45deg,
    #d0d0cd 0px, #d0d0cd 4px,
    #e5e5e3 4px, #e5e5e3 10px
  );
  border: 1.5px solid #b8b8b5;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
}
.desk-cell--pillar::after {
  content: '▪';
  font-size: 11px;
  color: var(--text-dim);
  opacity: 0.6;
}

/* Aisle spacer between desk groups */
.desk-cell--aisle {
  /* narrow — width set by grid-template-columns (12px) */
  min-height: 72px;
}

/* Inline tab bar hidden by default (portrait mobile) */
#tab-bar-inline { display: none; }

/* ── Landscape mobile + desktop: tabs move into header ── */
@media (orientation: landscape) and (max-height: 500px), (min-width: 768px) {
  #tab-bar        { display: none; }
  #tab-bar-inline { display: flex; gap: 4px; flex-shrink: 0; margin-left: 16px; }
}

/* ── Landscape mobile only: compact header + calendar ── */
@media (orientation: landscape) and (max-height: 500px) {
  :root { --header-h: 44px; }

  #app-header { padding-left: 12px; padding-right: 12px; gap: 8px; }
  .tab-btn    { padding: 5px 12px; font-size: 12px; flex: none; }
  .ib-icon    { width: 28px; height: 28px; border-radius: 7px; }
  .app-wordmark-bip,
  .app-wordmark-park { font-size: 14px; }
  .app-wordmark-city { font-size: 9px; }
  #today-btn  { font-size: 11px; padding: 4px 10px; }

  /* Collapse date-label row — arrows + strip become one line */
  #calendar-date-row { display: none; }
  #calendar-section  { padding: 0 8px; }
  .nav-arrow         { width: 24px; height: 24px; font-size: 15px; flex-shrink: 0; }

  #calendar-strip { padding: 4px 0; gap: 2px; }
  .day-btn        { padding: 3px 4px; min-width: 38px; gap: 0; }
  .day-name       { font-size: 9px; }
  .day-num        { font-size: 15px; line-height: 1; }
  .day-month      { display: none; }
}

/* ── Responsive ─────────────────────────────── */
@media (min-width: 540px) {
  #app-main { padding: 18px 18px; }
  .spot-num  { font-size: 12px; }
  .spot-name { font-size: 11px; }
}

@media (min-width: 600px) {
  .spot-card, .spot-entrance { min-height: 90px; }
}

@media (min-width: 640px) {
  #modal {
    max-width: 460px;
    left: 50%;
    right: auto;
    transform: translateX(-50%) translateY(100%);
    border-radius: 18px;
    bottom: 24px;
    border: none;
    border-top: 3px solid var(--ib-orange);
    box-shadow: 0 24px 64px rgba(54,57,59,0.20);
  }
  #modal.open { transform: translateX(-50%) translateY(0); }
}
