:root {
  color-scheme: dark;
  --bg: #06080a;
  --surface: #0d1117;
  --surface-soft: #161b22;
  --ink: #e6edf3;
  --muted: #7d8590;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #00f0ff;
  --accent-strong: #00d5e2;
  --green: #00ff9d;
  --orange: #ffb000;
  --red: #ff2e54;
  --gray: #30363d;
  --blue: #3b82f6;
  --seat-size: 15px;
  --seat-border: 2px;
  --seat-ring: 3px;
  --map-bg: #020202;
  --shadow: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 8px 24px rgba(0, 0, 0, 0.4);
  --glow: 0 0 20px rgba(0, 240, 255, 0.15);
  --spring: cubic-bezier(0.175, 0.885, 0.32, 1.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image: radial-gradient(circle at 50% 0%, rgba(0, 240, 255, 0.05) 0%, transparent 400px);
  color: var(--ink);
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1500px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

.hidden {
  display: none !important;
}

.home-view {
  display: grid;
  gap: 18px;
  min-height: calc(100vh - 56px);
  align-content: start;
  padding-top: 40px;
}

.hero {
  padding: 32px 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.8;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.coming-soon-badge {
  display: inline-block;
  margin-top: 12px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #8b5cf6;
  background-color: #ede9fe;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hero h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: #fff;
}

.hero .eyebrow {
  color: var(--accent);
  letter-spacing: 0.15em;
  font-size: 12px;
}

.library-card {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 0;
  min-height: 130px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: center;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

@media (hover: hover) {
  .library-card:hover {
    background: var(--surface-soft);
    border-color: rgba(0, 240, 255, 0.3);
    box-shadow: var(--shadow), var(--glow);
    transform: translateY(-2px);
  }

  .library-card.coming-soon:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--line);
  }
}

.library-card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 19px;
  color: #fff;
}

.library-card.coming-soon {
  opacity: 0.5;
  background: var(--bg);
  border: 1px dashed var(--muted);
}

.map-view {
  display: grid;
  gap: 12px;
}

.map-container {
  background: var(--map-bg, transparent);
  border-radius: 8px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  min-height: 108px;
  margin-bottom: 12px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

h1,
h2,
p {
  margin: 0;
}

h1, h2 {
  font-family: 'Space Grotesk', sans-serif;
  color: #fff;
}

h1 {
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: 0;
}

.subtitle {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.controls,
.floor-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
}

.controls {
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 26px rgba(25, 43, 34, 0.06);
}

.floor-tabs {
  padding-top: 17px;
}

.field {
  display: grid;
  gap: 5px;
  min-width: 170px;
}

#librarySelect {
  min-width: 220px;
}

.field.compact {
  min-width: 126px;
}

label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: #fff;
  padding: 0 10px;
  transition: border-color 0.2s ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--glow);
}

button {
  height: 38px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: transparent;
  color: var(--accent);
  padding: 0 16px;
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all 0.2s ease;
}

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

button:active:not(:disabled) {
  transform: scale(0.96);
}

button:disabled {
  border-color: var(--line);
  background: transparent;
  color: var(--muted);
  cursor: not-allowed;
}

@media (hover: hover) {
  button:hover:not(:disabled) {
    background: rgba(0, 240, 255, 0.1);
    box-shadow: var(--glow);
  }

  .secondary-button:hover:not(:disabled) {
    background: var(--surface-soft);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  }
}

.secondary-button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.tab {
  min-width: 124px;
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--muted);
}

.tab.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  min-width: 38px;
  padding: 0;
}

.icon-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.date-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.date-option {
  display: grid;
  align-content: center;
  justify-items: center;
  min-width: 92px;
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--ink);
  line-height: 1.05;
  white-space: nowrap;
  gap: 2px;
}

.date-option.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.date-option-weekday,
.date-option-date {
  display: block;
}

.date-option-weekday {
  font-size: 12px;
  font-weight: 700;
  text-transform: capitalize;
}

.date-option-date {
  font-size: 12px;
  font-weight: 700;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 14px;
  align-items: start;
}

.map-panel,
.details-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.map-panel {
  overflow: hidden;
  min-height: 620px;
}

.map-toolbar {
  position: sticky;
  left: 0;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 720px;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 17, 23, 0.8);
  padding: 12px 14px;
  backdrop-filter: blur(12px);
}

.map-toolbar strong {
  display: block;
  font-size: 15px;
}

.map-toolbar span,
.mini-legend {
  color: var(--muted);
  font-size: 12px;
}

.mini-legend {
  display: flex;
  gap: 12px;
  align-items: center;
  white-space: nowrap;
}

.map-toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mini-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.map-zoom-controls {
  display: inline-flex;
  gap: 6px;
}

.zoom-button {
  height: 34px;
  min-width: 34px;
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--ink);
  padding: 0 10px;
}

.zoom-button:hover {
  background: var(--line);
}

.zoom-value {
  min-width: 62px;
  font-size: 12px;
  font-weight: 700;
}

.map-viewport {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.map-viewport.pinching {
  touch-action: none;
}

.map-stage {
  position: relative;
  width: 100%;
  min-width: 100%;
  margin: 0 auto;
  --seat-scale: 1;
}

@keyframes fadeSwitch {
  0% {
    opacity: 0.2;
    filter: blur(4px);
    transform: scale(0.98);
  }
  100% {
    opacity: 1;
    filter: blur(0);
    transform: scale(1);
  }
}

.fade-switch {
  animation: fadeSwitch 0.4s var(--spring) forwards;
}

#floorImage {
  display: block;
  width: 100%;
  max-width: none;
  height: auto;
  margin: 0 auto;
  filter: saturate(0.9) contrast(1.02);
}

.seat-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.seat-tooltip {
  position: absolute;
  z-index: 5;
  display: none;
  max-width: min(220px, calc(100% - 16px));
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: rgba(6, 8, 10, 0.95);
  box-shadow: var(--glow);
  color: #fff;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  line-height: 1.4;
  padding: 10px 12px;
  pointer-events: auto;
  white-space: normal;
  backdrop-filter: blur(8px);
}

.tooltip-reservation-link {
  display: block;
  margin-top: 10px;
  padding: 6px 12px;
  background: var(--accent);
  color: #fff;
  text-align: center;
  border-radius: 4px;
  font-weight: 600;
  text-decoration: none;
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: all 0.2s ease;
}

.tooltip-reservation-link:hover {
  background: var(--accent-strong);
  box-shadow: var(--glow);
}

.seat-tooltip.visible {
  display: block;
}

.seat-tooltip strong {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
}

.tooltip-times {
  display: grid;
  grid-template-columns: repeat(2, minmax(54px, 1fr));
  gap: 4px 8px;
}

.tooltip-times span {
  display: block;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  padding: 3px 6px;
  text-align: center;
}

.seat {
  position: absolute;
  width: calc(var(--seat-size) * var(--seat-scale));
  height: calc(var(--seat-size) * var(--seat-scale));
  transform: translate(-50%, -50%);
  border: calc(var(--seat-border) * min(var(--seat-scale), 1.35)) solid rgba(16, 22, 19, 0.86);
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow:
    0 0 0 calc(var(--seat-ring) * min(var(--seat-scale), 1.35)) rgba(255, 255, 255, 0.72),
    0 3px 9px rgba(0, 0, 0, 0.18);
  transition: opacity 0.2s ease, width 0.2s ease, height 0.2s ease, border-color 0.2s ease;
}

.seat:active {
  transform: translate(-50%, -50%) !important;
}

.seat::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  display: none;
  width: 122%;
  height: max(1px, calc(var(--seat-border) * min(var(--seat-scale), 1.35) * 1.25));
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 1px rgba(66, 15, 14, 0.22);
  transform: translate(-50%, -50%) rotate(-42deg);
  transform-origin: center;
}

.seat.available {
  background: var(--green);
}

.seat.partial {
  border-color: var(--orange);
  background: var(--orange);
  box-shadow: 0 0 0 var(--seat-ring) rgba(255, 255, 255, 0.78), 0 3px 9px rgba(0, 0, 0, 0.18);
}

.seat.busy {
  background: var(--red);
}

.seat.busy::after {
  display: block;
}

.seat.unknown {
  border-color: var(--gray);
  background: rgba(255, 255, 255, 0.92);
  opacity: 0.78;
}

.seat.selected {
  width: calc(var(--seat-size) * var(--seat-scale) + 8px);
  height: calc(var(--seat-size) * var(--seat-scale) + 8px);
  z-index: 2;
  box-shadow: 0 0 0 4px rgba(0, 240, 255, 0.3), var(--glow);
  border-color: var(--accent);
}

.details-panel {
  padding: 18px;
  min-height: 320px;
  position: sticky;
  top: 14px;
}

.details-close {
  display: none;
}

.panel-kicker {
  margin-bottom: 5px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.details-panel h2 {
  margin-bottom: 8px;
  font-size: 19px;
  line-height: 1.25;
}

.details-panel p,
.details-text {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.details-text {
  display: grid;
  gap: 8px;
}

.details-text p {
  margin: 0;
  white-space: pre-line;
}

.section-label {
  margin-top: 4px;
  color: var(--ink);
  font-weight: 700;
}

.slot-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(76px, 1fr));
  gap: 7px;
  margin: 2px 0 4px;
}

.slot-button {
  height: 34px;
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--ink);
  padding: 0 8px;
}

.slot-button:hover,
.slot-button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.reservation-box {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.reservation-hint {
  color: var(--ink);
  font-weight: 700;
}

.reservation-warning {
  color: #775112;
}

.reservation-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  padding: 0 14px;
  font-weight: 700;
  text-decoration: none;
}

.reservation-link:hover {
  background: var(--accent-strong);
}

.legend {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
}

.legend div {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  align-items: center;
}

.legend dd {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.map-viewport {
  position: relative;
  flex: 1 1 0;
  min-height: 480px;
  overflow: hidden;
  background: var(--map-bg, #020202);
  border-radius: 8px;
  touch-action: none;
  border: 1px solid var(--line);
}

.map-loader {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(6, 8, 10, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  z-index: 100;
  color: var(--accent);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.map-loader.hidden {
  display: none !important;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(0, 240, 255, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.dot {
  position: relative;
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1px solid #111;
}

.dot.available {
  background: var(--green);
}

.dot.partial {
  border-color: var(--orange);
  background: var(--orange);
}

.dot.busy {
  background: var(--red);
}

.dot.busy::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 130%;
  height: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  transform: translate(-50%, -50%) rotate(-42deg);
}

.dot.unknown {
  border-color: var(--gray);
  background: rgba(255, 255, 255, 0.92);
  opacity: 0.78;
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .details-panel {
    order: -1;
    position: static;
  }
}

@media (max-width: 700px) {
  .workspace {
    display: block;
  }

  .details-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    order: initial;
    max-height: min(72vh, 620px);
    min-height: 0;
    overflow: auto;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 12px 12px 0 0;
    padding: 18px 18px calc(20px + env(safe-area-inset-bottom));
    box-shadow: 0 -16px 42px rgba(12, 24, 20, 0.24);
    transform: translateY(calc(100% + 18px));
    transition: transform 180ms ease;
    visibility: hidden;
    pointer-events: none;
  }

  .details-panel.open {
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
  }

  .details-close {
    position: absolute;
    top: 10px;
    right: 10px;
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-color: var(--line);
    border-radius: 50%;
    background: var(--surface-soft);
    color: var(--ink);
    padding: 0;
    font-size: 24px;
    line-height: 1;
  }

  .details-close:hover {
    background: var(--line);
  }

  .details-panel .panel-kicker,
  .details-panel h2 {
    padding-right: 42px;
  }

  .map-toolbar {
    min-width: 0;
    flex-wrap: wrap;
    align-items: start;
  }

  .map-toolbar-right {
    width: 100%;
    justify-content: space-between;
  }

  .map-viewport {
    overflow: auto;
    touch-action: pan-x pan-y;
    overscroll-behavior: contain;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100vw - 18px, 1500px);
    padding-top: 12px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    padding: 18px;
  }

  .hero {
    padding: 22px 18px;
  }

  h1 {
    font-size: 28px;
  }

  .top-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .field,
  .field {
    width: 100%;
  }

  .date-option {
    flex: 1 1 calc(33.33% - 8px);
    height: 54px;
    min-width: 0;
    padding: 0 8px;
  }

  .map-panel {
    min-height: 420px;
  }

  .library-grid {
    grid-template-columns: 1fr;
  }

  .map-toolbar {
    min-width: 0;
  }

  .seat-tooltip {
    font-size: 11px;
  }
}

@media (max-width: 520px) {
  :root {
    --seat-size: 6px;
    --seat-border: 1px;
    --seat-ring: 1px;
  }

  .seat.selected {
    width: 10px;
    height: 10px;
  }
}

@media (max-width: 380px) {
  :root {
    --seat-size: 5px;
    --seat-ring: 1px;
  }
}

.mobile-text { display: none; }
@media (max-width: 700px) {
  .desktop-text { display: none; }
  .mobile-text { display: inline; }
}
