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

:root {
  --violet: #7c3aed;
  --violet-dark: #6d28d9;
  --pink: #db2777;
  --green: #16a34a;
  --green-light: #dcfce7;
  --green-border: #86efac;
  --red: #ef4444;
  --bg: #fdf4ff;
  --surface: #ffffff;
  --text: #1e1b4b;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --radius: 18px;
  --radius-sm: 10px;
  --shadow: 0 2px 8px rgba(124,58,237,.08), 0 1px 3px rgba(0,0,0,.06);
  --shadow-hover: 0 16px 32px rgba(124,58,237,.16), 0 4px 8px rgba(0,0,0,.08);
  --shadow-panel: 0 24px 48px rgba(0,0,0,.2), 0 8px 16px rgba(0,0,0,.1);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ─── Hero ─────────────────────────────────────────────────── */

.hero {
  position: relative;
  padding: 3.5rem 1.5rem 3rem;
  text-align: center;
  overflow: hidden;
  background: linear-gradient(135deg, #5b21b6 0%, #7c3aed 40%, #9333ea 70%, #db2777 100%);
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 80%, rgba(255,255,255,.07) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255,255,255,.07) 0%, transparent 50%);
  pointer-events: none;
}

.hero-content { position: relative; z-index: 1; }

.hero-icon {
  font-size: 4rem;
  display: block;
  margin-bottom: 1rem;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,.25));
  animation: float 4s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-10px) rotate(2deg); }
}

.hero h1 {
  color: #fff;
  font-size: clamp(2rem, 6vw, 3.25rem);
  font-weight: 800;
  letter-spacing: -.02em;
  text-shadow: 0 2px 12px rgba(0,0,0,.2);
  margin-bottom: .5rem;
}

#list-subtitle {
  color: rgba(255,255,255,.75);
  font-size: 1rem;
  font-weight: 400;
}

.admin-btn {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  color: rgba(255,255,255,.9);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .2s, transform .15s;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.admin-btn:hover { background: rgba(255,255,255,.25); transform: rotate(30deg); }

/* ─── Stats bar ─────────────────────────────────────────────── */

.stats-bar {
  text-align: center;
  font-size: .875rem;
  color: var(--text-muted);
  padding: .375rem 0 .875rem;
  font-weight: 500;
}
.stats-sep { margin: 0 .5rem; }

/* ─── Main / Grid ───────────────────────────────────────────── */

main {
  max-width: 1200px;
  margin: 0 auto 4rem;
  padding: .75rem 1.5rem 0;
  position: relative;
  z-index: 1;
}

.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

/* ─── Card ──────────────────────────────────────────────────── */

.item-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  border: 2px solid transparent;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), box-shadow .25s ease, border-color .2s, background .2s;
  display: flex;
  flex-direction: column;
}

.item-card:hover:not(.claimed) {
  transform: translateY(-6px) scale(1.01);
  box-shadow: var(--shadow-hover);
  border-color: rgba(124,58,237,.2);
}

.item-card:active:not(.claimed) {
  transform: translateY(-2px) scale(.99);
}

.item-card.claimed {
  background: var(--green-light);
  border-color: var(--green-border);
  cursor: default;
}

.item-card.claimed .card-name {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* Checkmark badge */
.claimed-check {
  position: absolute;
  top: .75rem;
  right: .75rem;
  background: var(--green);
  color: #fff;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  box-shadow: 0 3px 10px rgba(22,163,74,.5);
  animation: popIn .3s cubic-bezier(.34,1.56,.64,1);
  z-index: 2;
}
.item-card.claimed .claimed-check { display: flex; }

@keyframes popIn {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Delete button (admin mode only) */
.delete-btn {
  position: absolute;
  top: .5rem;
  right: .5rem;
  background: rgba(255,255,255,.85);
  color: var(--text-muted);
  border: none;
  border-radius: 6px;
  width: 26px;
  height: 26px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: .75rem;
  transition: background .15s, color .15s;
  z-index: 3;
  backdrop-filter: blur(4px);
}
.delete-btn:hover { background: #fee2e2; color: var(--red); }
body.admin-mode .delete-btn { display: flex; }

/* Admin unclaim button — bottom-left of card, only on claimed items in admin mode */
.admin-unclaim-btn {
  position: absolute;
  bottom: .5rem;
  left: .5rem;
  background: rgba(255,255,255,.85);
  color: var(--text-muted);
  border: none;
  border-radius: 6px;
  width: 26px;
  height: 26px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: .875rem;
  transition: background .15s, color .15s;
  z-index: 3;
  backdrop-filter: blur(4px);
}
.admin-unclaim-btn:hover { background: #fef9c3; color: #a16207; }
body.admin-mode .admin-unclaim-btn { display: flex; }

/* "Is mine" card — your own claim */
.item-card.is-mine { border-color: #6ee7b7; }
.item-card.is-mine:hover { cursor: pointer; }

.is-mine-badge { background: rgba(5,150,105,.15) !important; color: #059669 !important; }

/* Card image */
.card-image-wrap {
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(135deg, #ede9fe, #fce7f3);
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .4s ease;
}
.item-card:hover:not(.claimed) .card-image { transform: scale(1.04); }

.card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ede9fe 0%, #fce7f3 100%);
  background-clip: text;
  -webkit-background-clip: text;
}

.card-placeholder-letter {
  background: linear-gradient(135deg, var(--violet), var(--pink));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: uppercase;
  font-size: 3.5rem;
  font-weight: 800;
}

/* Card body */
.card-body {
  padding: 1.1rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: .3rem;
}

.card-note {
  font-size: .8125rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: .75rem;
}

.card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  flex-wrap: wrap;
}

.card-link {
  font-size: .8rem;
  color: var(--violet);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: .3rem;
  font-weight: 500;
  opacity: .85;
  transition: opacity .15s;
  white-space: nowrap;
}
.card-link:hover { opacity: 1; }

.claimed-badge {
  display: none;
  align-items: center;
  gap: .35rem;
  font-size: .75rem;
  color: var(--green);
  font-weight: 600;
  background: rgba(22,163,74,.12);
  padding: .2rem .55rem;
  border-radius: 20px;
  white-space: nowrap;
}
.item-card.claimed .claimed-badge { display: flex; }

/* ─── Empty state ───────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 5rem 1rem 3rem;
  color: var(--text-muted);
}
.empty-icon { font-size: 4rem; margin-bottom: 1rem; }
.empty-state p { font-size: 1.05rem; margin-bottom: .35rem; }
.empty-sub { font-size: .875rem; opacity: .7; }

/* ─── Overlay / Modals ──────────────────────────────────────── */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,10,40,.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  padding: 1rem;
}

/* Admin panel – slides in from the right */
.admin-panel {
  background: var(--surface);
  border-radius: var(--radius);
  width: min(420px, 100%);
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  box-shadow: var(--shadow-panel);
  margin-left: auto;
  animation: slideRight .3s cubic-bezier(.34,1.2,.64,1);
  display: flex;
  flex-direction: column;
}

@keyframes slideRight {
  from { transform: translateX(60px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.panel-header h2 {
  font-size: 1.125rem;
  font-weight: 700;
}

.panel-section {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #f3f4f6;
}
.panel-section:last-child { border-bottom: none; }

.section-label {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  margin-bottom: .75rem;
}

.reservation-row {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  padding: .4rem 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: .875rem;
}
.reservation-row:last-child { border-bottom: none; }
.reservation-name {
  font-weight: 600;
  color: var(--violet);
  white-space: nowrap;
  flex-shrink: 0;
}
.reservation-item {
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hint-section {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  font-size: .8125rem;
  color: var(--text-muted);
  background: #faf5ff;
  line-height: 1.5;
}
.hint-section svg { flex-shrink: 0; margin-top: .15rem; }

/* Claim panel – centered */
.claim-panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2.25rem 2rem;
  width: min(400px, 100%);
  box-shadow: var(--shadow-panel);
  margin: auto;
  animation: scaleIn .3s cubic-bezier(.34,1.3,.64,1);
  text-align: center;
}

@keyframes scaleIn {
  from { transform: scale(.88); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.claim-icon {
  font-size: 2.75rem;
  margin-bottom: .75rem;
  animation: float 3s ease-in-out infinite;
}
.claim-panel h2 { font-size: 1.25rem; font-weight: 700; margin-bottom: .4rem; }
.claim-item-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--violet);
  margin-bottom: 1.25rem;
  line-height: 1.3;
}
.claim-hint {
  font-size: .875rem;
  color: var(--text-muted);
  margin-bottom: .75rem;
  line-height: 1.5;
}
.claim-panel input { margin-bottom: 1.25rem; }

.claim-buttons {
  display: flex;
  gap: .75rem;
}

/* ─── Form elements ─────────────────────────────────────────── */

input, textarea, select {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .65rem 1rem;
  font-size: .9375rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  width: 100%;
}
input:focus, textarea:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(124,58,237,.15);
}
textarea { resize: vertical; min-height: 72px; }

.block-input { display: block; width: 100%; margin-bottom: .6rem; }

.input-row { display: flex; gap: .5rem; }
.input-row input { flex: 1; min-width: 0; }

/* ─── Buttons ───────────────────────────────────────────────── */

button {
  border: none;
  border-radius: var(--radius-sm);
  padding: .65rem 1.2rem;
  font-size: .9375rem;
  font-family: inherit;
  cursor: pointer;
  font-weight: 600;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--violet) 0%, var(--pink) 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(124,58,237,.35);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(124,58,237,.5); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--violet); color: var(--violet); background: rgba(124,58,237,.04); }

.btn-ghost {
  background: #f3f4f6;
  color: var(--text-muted);
  flex: 1;
}
.btn-ghost:hover { background: #e5e7eb; }

.full-width { width: 100%; }

.btn-danger {
  background: #fee2e2;
  color: var(--red);
  border: 1.5px solid #fecaca;
  flex: 2;
}
.btn-danger:hover { background: #fecaca; }

.btn-logout {
  background: #fff1f2;
  color: #e11d48;
  border: 1.5px solid #fecdd3;
}
.btn-logout:hover { background: #ffe4e6; border-color: #fda4af; }

.icon-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { background: #f3f4f6; color: var(--text); }

.claim-buttons .btn-primary { flex: 2; }

/* ─── Misc ──────────────────────────────────────────────────── */

.error-msg {
  color: var(--red);
  font-size: .8125rem;
  margin-top: .5rem;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Landing page ──────────────────────────────────────────── */

.landing {
  text-align: center;
  padding: 3rem 1.5rem 4rem;
  max-width: 520px;
  margin: 0 auto;
}
.landing-icon { font-size: 3.5rem; margin-bottom: 1.25rem; }
.landing h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: .75rem; }
.landing > p { color: var(--text-muted); line-height: 1.6; margin-bottom: 1.25rem; }
.landing-example {
  display: inline-flex;
  align-items: center;
  background: white;
  border: 2px solid rgba(124,58,237,.2);
  border-radius: var(--radius-sm);
  padding: .6rem 1rem;
  font-size: 1rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}
.landing-origin { color: var(--text-muted); }
.landing-sub { font-size: .875rem; color: var(--text-muted); }

/* ─── Responsive ────────────────────────────────────────────── */

@media (max-width: 480px) {
  .hero { padding: 2.5rem 1rem 4rem; }
  main { padding: 0 .875rem; }
  .items-grid { grid-template-columns: 1fr; gap: 1rem; }
  .claim-panel { padding: 1.75rem 1.25rem; }
  .admin-panel { width: 100%; }
}
