/* ── Reset & tokens ──────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

:root {
  --bg: #0d0e14;
  --surface: #13141d;
  --surface2: #1a1c28;
  --border: rgba(255, 255, 255, .07);
  --border-h: rgba(255, 255, 255, .14);
  --primary: #6366f1;
  --primary-h: #818cf8;
  --accent: #8b5cf6;
  --text: #e2e4f0;
  --text-muted: #6b7280;
  --text-dim: #9ca3af;
  --green: #10b981;
  --red: #ef4444;
  --yellow: #f59e0b;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 32px rgba(0, 0, 0, .6);
}

/* ── Base ────────────────────────────────────────────────────────────────── */
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Ambient glow */
.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 40% at 20% 10%, rgba(99, 102, 241, .15) 0%, transparent 70%),
    radial-gradient(ellipse 50% 50% at 80% 80%, rgba(139, 92, 246, .1) 0%, transparent 70%);
  z-index: 0;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px);
  background: rgba(13, 14, 20, .85);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--text);
}

/* ── Status badge ────────────────────────────────────────────────────────── */
.badge {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge--checking .badge-dot {
  background: var(--yellow);
  animation: pulse 1.2s ease-in-out infinite;
}

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

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

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: .35;
  }
}

/* ── Main layout ─────────────────────────────────────────────────────────── */
.main {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 36px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Card ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  transition: border-color .2s;
}

.card:hover {
  border-color: var(--border-h);
}

/* ── Search card ─────────────────────────────────────────────────────────── */
.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -.02em;
  margin-bottom: 4px;
}

.section-sub {
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 22px;
}

.input-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.input-group {
  flex: 1;
}

.label {
  display: block;
  font-size: .78rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 6px;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.input {
  width: 100%;
  padding: 11px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: .95rem;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .2);
}

.input::placeholder {
  color: var(--text-muted);
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, transform .1s, opacity .2s;
  white-space: nowrap;
}

.btn:active {
  transform: scale(.97);
}

.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.btn--primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
}

.btn--primary:hover:not(:disabled) {
  filter: brightness(1.12);
}

.btn--ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.btn--ghost:hover {
  border-color: var(--border-h);
  color: var(--text);
}

.btn--sm {
  padding: 7px 13px;
  font-size: .8rem;
}

.btn-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ── State messages ─────────────────────────────────────────────────────── */
.state-msg {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px 24px;
  border-radius: var(--radius);
  font-size: .9rem;
}

.state-msg--loading {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.state-msg--error {
  background: rgba(239, 68, 68, .08);
  border: 1px solid rgba(239, 68, 68, .25);
  color: #fca5a5;
}

.state-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.error-body {
  margin-top: 6px;
  font-size: .8rem;
  white-space: pre-wrap;
  word-break: break-all;
  opacity: .8;
}

/* Spinner */
.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}

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

/* ── Result card ─────────────────────────────────────────────────────────── */
.result-card {
  animation: fadeUp .3s ease;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

.guest-name {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -.03em;
  margin-bottom: 8px;
}

.meta-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Tags */
.tag {
  padding: 3px 10px;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 500;
}

.tag--id {
  background: rgba(99, 102, 241, .15);
  color: var(--primary-h);
  border: 1px solid rgba(99, 102, 241, .3);
}

.tag--status {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.tag--status.status-reserved {
  background: rgba(16, 185, 129, .12);
  color: #34d399;
  border-color: rgba(16, 185, 129, .3);
}

.tag--status.status-inhouse {
  background: rgba(99, 102, 241, .12);
  color: var(--primary-h);
  border-color: rgba(99, 102, 241, .3);
}

.tag--status.status-checkedout {
  background: var(--surface2);
  color: var(--text-muted);
}

.tag--status.status-cancelled {
  background: rgba(239, 68, 68, .1);
  color: #f87171;
  border-color: rgba(239, 68, 68, .25);
}

/* Detail grid */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.detail-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.detail-label {
  display: block;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.detail-value {
  font-size: .92rem;
  font-weight: 500;
  color: var(--text);
  word-break: break-all;
}

/* Raw JSON */
.raw-section {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.raw-json {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-size: .78rem;
  line-height: 1.6;
  color: #a5b4fc;
  overflow: auto;
  max-height: 420px;
  white-space: pre;
}

/* ── Tabs ───────────────────────────────────────────────────────────────── */
.tab-nav {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 20px;
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 14px;
  border: none;
  border-radius: calc(var(--radius-sm) - 2px);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}

.tab-btn svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.tab-btn:hover {
  background: var(--surface2);
  color: var(--text-dim);
}

.tab-btn--active {
  background: var(--surface2);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .4);
}

.tab-panel {
  display: block;
}

/* ── Reservation table ───────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-top: 4px;
}

.res-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.res-table th {
  background: var(--surface2);
  color: var(--text-muted);
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 11px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.res-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.res-table tbody tr:last-child td {
  border-bottom: none;
}

.res-table tbody tr {
  transition: background .12s;
}

.res-table tbody tr:hover {
  background: var(--surface2);
}

.res-table .col-name {
  font-weight: 500;
}

.res-table .col-id {
  font-family: monospace;
  font-size: .8rem;
  color: var(--text-dim);
}

.empty-list {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: .9rem;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .input-row {
    flex-direction: column;
  }

  .btn--primary {
    width: 100%;
    justify-content: center;
  }

  .result-header {
    flex-direction: column;
  }

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

/* ── Login overlay ──────────────────────────────────────────────────────── */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 32px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 380px;
}

.login-error {
  color: var(--red);
  font-size: .82rem;
  margin-bottom: 12px;
  text-align: center;
}