/* ============================================================
   VIRTUAL ART GALLERY — Global Design System
   Stack: Cloudflare Pages + Supabase + Cloudflare R2
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;0,900;1,400;1,700&family=Inter:wght@300;400;500;600;700&display=swap');

/* ── CSS Tokens ─────────────────────────────────────────── */
:root {
  --bg-dark:       #09090f;
  --bg-dark-2:     #111120;
  --bg-dark-3:     #181830;
  --bg-light:      #f9f6f0;
  --bg-light-2:    #f0ece3;
  --surface:       rgba(255,255,255,0.05);
  --surface-border:rgba(255,255,255,0.09);

  --gold:          #c9a84c;
  --gold-light:    #e8c96e;
  --coral:         #d95f3b;
  --cream:         #f5edd9;
  --text-white:    #f2eeea;
  --text-muted:    rgba(242,238,234,0.55);
  --text-dark:     #1a1814;
  --text-dark-2:   #3d3a35;

  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  20px;
  --radius-xl:  32px;

  --shadow-card: 0 8px 32px rgba(0,0,0,0.35);
  --shadow-glow: 0 0 40px rgba(201,168,76,0.15);

  --transition: 0.3s cubic-bezier(0.4,0,0.2,1);
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans:  'Inter', system-ui, sans-serif;

  --nav-h: 68px;
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-sans);
  background: var(--bg-dark);
  color: var(--text-white);
  line-height: 1.6;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; }
ul { list-style: none; }

/* ── Typography ─────────────────────────────────────────── */
h1,h2,h3,h4 { font-family: var(--font-serif); line-height: 1.15; }
h1 { font-size: clamp(2.5rem, 6vw, 5rem); font-weight: 700; }
h2 { font-size: clamp(1.8rem, 4vw, 3rem); font-weight: 600; }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.7rem); font-weight: 600; }
h4 { font-size: 1.1rem; font-weight: 600; }
p  { color: var(--text-muted); line-height: 1.75; }

.text-gold   { color: var(--gold); }
.text-cream  { color: var(--cream); }
.text-muted  { color: var(--text-muted); }
.text-center { text-align: center; }
.serif       { font-family: var(--font-serif); }

/* ── Layout Utilities ───────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}
.section { padding: 100px 0; }
.section-sm { padding: 60px 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 28px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 24px; }
.flex   { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.mt-8   { margin-top: 8px; }
.mt-16  { margin-top: 16px; }
.mt-24  { margin-top: 24px; }
.mt-40  { margin-top: 40px; }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 28px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-gold {
  background: linear-gradient(135deg, var(--gold), #a8893a);
  color: #1a1200;
}
.btn-gold:hover { background: linear-gradient(135deg, var(--gold-light), var(--gold)); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(201,168,76,0.4); }

.btn-outline {
  border: 1.5px solid rgba(255,255,255,0.25);
  color: var(--text-white);
  backdrop-filter: blur(8px);
}
.btn-outline:hover { border-color: var(--gold); color: var(--gold); transform: translateY(-2px); }

.btn-dark {
  background: var(--bg-dark-2);
  color: var(--text-white);
  border: 1.5px solid var(--surface-border);
}
.btn-dark:hover { border-color: var(--gold); color: var(--gold); }

.btn-ghost {
  color: var(--text-muted);
  padding: 8px 16px;
}
.btn-ghost:hover { color: var(--text-white); }

.btn-lg { padding: 17px 36px; font-size: 1.05rem; border-radius: var(--radius-lg); }
.btn-sm { padding: 8px 18px; font-size: 0.85rem; }

/* ── Navigation ─────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  transition: var(--transition);
}
.nav.scrolled {
  background: rgba(9,9,15,0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--surface-border);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.nav-logo {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-logo .logo-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--gold);
  display: inline-block;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
}
.nav-links a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--transition);
}
.nav-links a:hover, .nav-links a.active { color: var(--text-white); }
.nav-actions { display: flex; align-items: center; gap: 12px; }

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
}
.hamburger span {
  display: block;
  width: 24px; height: 2px;
  background: var(--text-white);
  border-radius: 2px;
  transition: var(--transition);
}

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--bg-dark-2);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
}
.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-card);
  border-color: rgba(201,168,76,0.2);
}
.card-img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
}
.card-body { padding: 20px 22px; }
.card-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
}
.card-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-white);
  margin-bottom: 6px;
  line-height: 1.3;
}
.card-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── Exhibition Card (discover grid) ────────────────────── */
.ex-card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 3/4;
  background: var(--bg-dark-2);
}
.ex-card img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.4,0,0.2,1);
}
.ex-card:hover img { transform: scale(1.08); }
.ex-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.1) 60%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 24px;
  opacity: 1;
  transition: var(--transition);
}
.ex-card:hover .ex-card-overlay { background: linear-gradient(to top, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.4) 60%, rgba(0,0,0,0.1) 100%); }
.ex-card-visit {
  margin-top: 12px;
  opacity: 0;
  transform: translateY(10px);
  transition: var(--transition);
}
.ex-card:hover .ex-card-visit { opacity: 1; transform: translateY(0); }

/* ── Section Headers ─────────────────────────────────────── */
.section-label {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 16px;
}
.section-title {
  font-family: var(--font-serif);
  color: var(--text-white);
  margin-bottom: 16px;
}
.section-desc {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 560px;
  line-height: 1.8;
}

/* ── Divider ─────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--surface-border);
  margin: 0;
}

/* ── Badge ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-gold { background: rgba(201,168,76,0.15); color: var(--gold); border: 1px solid rgba(201,168,76,0.3); }
.badge-green { background: rgba(52,211,153,0.1); color: #34d399; border: 1px solid rgba(52,211,153,0.25); }
.badge-red { background: rgba(239,68,68,0.1); color: #f87171; border: 1px solid rgba(239,68,68,0.25); }
.badge-gray { background: rgba(255,255,255,0.06); color: var(--text-muted); border: 1px solid var(--surface-border); }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-white); margin-bottom: 8px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255,255,255,0.06);
  border: 1.5px solid var(--surface-border);
  border-radius: var(--radius-md);
  color: var(--text-white);
  font-size: 0.95rem;
  transition: border-color var(--transition);
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--gold);
  background: rgba(255,255,255,0.08);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }
.form-select option { background: var(--bg-dark-2); }
.form-textarea { resize: vertical; min-height: 100px; }

/* ── Toast ───────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 28px; right: 28px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.toast {
  padding: 14px 22px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  backdrop-filter: blur(12px);
  animation: slideIn 0.3s ease;
  min-width: 280px;
}
.toast-success { background: rgba(52,211,153,0.15); border: 1px solid rgba(52,211,153,0.35); color: #6ee7b7; }
.toast-error   { background: rgba(239,68,68,0.15);  border: 1px solid rgba(239,68,68,0.35);  color: #fca5a5; }
.toast-info    { background: rgba(201,168,76,0.15);  border: 1px solid rgba(201,168,76,0.35);  color: var(--gold); }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-dark-2);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform var(--transition);
}
.modal-overlay.active .modal { transform: translateY(0); }
.modal-header {
  padding: 28px 32px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.modal-body { padding: 24px 32px 32px; }
.modal-close {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}
.modal-close:hover { background: rgba(255,255,255,0.12); color: var(--text-white); }

/* ── Stat Numbers ────────────────────────────────────────── */
.stat-number {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 4vw, 3.5rem);
  font-weight: 700;
  color: var(--text-white);
  line-height: 1;
}
.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ── Loading Spinner ─────────────────────────────────────── */
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--surface-border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  gap: 16px;
  color: var(--text-muted);
}

/* ── Empty State ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 80px 20px;
}
.empty-state .icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { color: var(--text-white); margin-bottom: 8px; }

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

/* ── Animations ──────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.fade-up {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.fade-up.visible { opacity: 1; transform: translateY(0); }

/* ── Skeleton Loaders ────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-dark-2) 25%, var(--bg-dark-3) 50%, var(--bg-dark-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-md);
}

/* ── Footer ──────────────────────────────────────────────── */
.footer {
  background: var(--bg-dark);
  border-top: 1px solid var(--surface-border);
  padding: 60px 0 32px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 48px;
}
.footer-logo { font-family: var(--font-serif); font-size: 1.3rem; font-weight: 700; margin-bottom: 14px; }
.footer-desc { font-size: 0.9rem; color: var(--text-muted); line-height: 1.7; }
.footer-col h4 { font-size: 0.85rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 16px; }
.footer-col li { margin-bottom: 10px; }
.footer-col a { font-size: 0.9rem; color: var(--text-muted); transition: color var(--transition); }
.footer-col a:hover { color: var(--gold); }
.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 28px;
  border-top: 1px solid var(--surface-border);
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ── Dashboard Sidebar ───────────────────────────────────── */
.dash-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  padding-top: var(--nav-h);
}
.sidebar {
  background: var(--bg-dark-2);
  border-right: 1px solid var(--surface-border);
  padding: 32px 0;
  position: sticky;
  top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  overflow-y: auto;
}
.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: var(--transition);
  border-left: 3px solid transparent;
}
.sidebar-nav li a:hover  { color: var(--text-white); background: rgba(255,255,255,0.04); }
.sidebar-nav li a.active {
  color: var(--gold);
  background: rgba(201,168,76,0.07);
  border-left-color: var(--gold);
}
.sidebar-nav li a .icon { font-size: 1.1rem; width: 20px; text-align: center; }
.dash-content { padding: 40px 48px; }
.dash-section { display: none; }
.dash-section.active { display: block; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2,1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
  .dash-layout { grid-template-columns: 220px 1fr; }
  .dash-content { padding: 32px 28px; }
}
@media (max-width: 768px) {
  .nav-links, .nav-actions .btn-outline { display: none; }
  .hamburger { display: flex; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .dash-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; position: static; height: auto; }
  .sidebar.open { display: block; }
  .dash-content { padding: 24px 20px; }
  h1 { font-size: 2.2rem; }
}
@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .btn-lg { padding: 14px 24px; font-size: 0.95rem; }
}
