:root {
  --primary: #1F7A8C;
  --secondary: #E56B6F;
  --bg: #F4F7FA;
  --card: #FFFFFF;
  --text: #182033;
  --muted: #667085;
  --line: rgba(24,32,51,.11);
  --soft: rgba(24,32,51,.045);
  --shadow: 0 18px 48px rgba(32,47,71,.10);
  --page-bg: linear-gradient(180deg, #F8FAFC 0%, #EDF3F7 100%);
  --glass-bg: rgba(255,255,255,.78);
  --topbar-bg: rgba(248,250,252,.86);
  --brand-gradient: linear-gradient(135deg, var(--primary), #5BB7A6);
  --button-bg: var(--text);
  --button-text: #ffffff;
  --ghost-bg: rgba(255,255,255,.65);
  --input-bg: rgba(255,255,255,.82);
  --tab-bg: var(--text);
  --tab-text: #ffffff;
  --hero-filter: saturate(.78) contrast(.92);
  --orbit-line: rgba(24,32,51,.10);
  --bottom-bg: rgba(255,255,255,.9);
  --toast-bg: rgba(255,255,255,.96);
  --radius: 14px;
}

:root[data-theme="dark"] {
  --primary: #8B7CF6;
  --secondary: #F59E9E;
  --bg: #10131B;
  --card: #181C27;
  --text: #F8FAFC;
  --muted: #AAB2C3;
  --line: rgba(255,255,255,.10);
  --soft: rgba(255,255,255,.06);
  --shadow: 0 18px 56px rgba(0,0,0,.30);
  --page-bg: linear-gradient(180deg, #11141D 0%, #0B0E14 100%);
  --glass-bg: rgba(24,28,39,.78);
  --topbar-bg: rgba(16,19,27,.86);
  --brand-gradient: linear-gradient(135deg, #8B7CF6, #38BDF8);
  --button-bg: #F8FAFC;
  --button-text: #10131B;
  --ghost-bg: rgba(255,255,255,.07);
  --input-bg: rgba(255,255,255,.055);
  --tab-bg: #F8FAFC;
  --tab-text: #10131B;
  --hero-filter: saturate(.76) brightness(.70);
  --orbit-line: rgba(255,255,255,.13);
  --bottom-bg: rgba(24,28,39,.92);
  --toast-bg: rgba(24,28,39,.96);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Poppins", Arial, sans-serif;
  background: var(--page-bg);
  color: var(--text);
  padding-bottom: 84px;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
img { width: 100%; display: block; }
body, input, select, textarea, button { -webkit-tap-highlight-color: transparent; }

.loader {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: var(--bg);
  transition: opacity .35s ease, visibility .35s ease;
}
.loader.hide { opacity: 0; visibility: hidden; }
.loader span {
  width: 52px;
  height: 52px;
  border: 4px solid rgba(24,32,51,.12);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .9s linear infinite;
}

.page-fade { animation: fadeIn .55s ease both; }
.slide-up { animation: slideUp .7s ease both; }
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.container { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.narrow { width: min(760px, calc(100% - 32px)); }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 16px max(16px, calc((100vw - 1180px) / 2));
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}
.brand, .nav-links, .user-area { display: flex; align-items: center; gap: 14px; }
.brand span, .brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: var(--brand-gradient);
  color: #ffffff;
  font-weight: 800;
}
.nav-links a { color: var(--muted); font-size: .95rem; }
.nav-links a.active, .nav-links a:hover { color: var(--text); }
.user-pill { color: var(--muted); font-size: .9rem; min-width: 0; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.theme-toggle {
  min-width: 92px;
}

.auth-theme {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 25;
}

.btn {
  position: relative;
  overflow: hidden;
  border: 0;
  border-radius: 12px;
  padding: 12px 17px;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  transition: transform .2s ease, box-shadow .2s ease;
}
.btn:hover { transform: translateY(-2px); }
.primary { background: var(--button-bg); color: var(--button-text); box-shadow: 0 12px 28px rgba(24,32,51,.14); }
.ghost { background: var(--ghost-bg); border: 1px solid var(--line); }
.link { color: var(--primary); font-weight: 600; }
.ripple .ink {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  background: rgba(255,255,255,.35);
  animation: ripple .55s ease-out;
}

.auth-shell {
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.08fr .92fr;
  gap: 30px;
  align-items: center;
}
.auth-brand h1, .hero h1, .compact-hero h1, .info-page h1 { font-size: clamp(2.25rem, 6vw, 4.8rem); line-height: 1.04; margin: 12px 0; letter-spacing: 0; font-weight: 700; }
.auth-brand p, .hero p, .info-page p { color: var(--muted); max-width: 650px; }
.auth-stats { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 28px; }
.auth-stats div { min-width: 110px; padding: 16px; border-radius: 14px; background: var(--soft); border: 1px solid var(--line); }
.auth-stats strong { display: block; font-size: 1.35rem; }
.auth-stats span { color: var(--muted); font-size: .85rem; }
.auth-card, .form-card, .profile-card, .info-page { border-radius: var(--radius); padding: 26px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.tab { border: 0; color: var(--muted); padding: 12px; border-radius: 12px; background: var(--soft); cursor: pointer; }
.tab.active { color: var(--tab-text); background: var(--tab-bg); }
.auth-form { display: none; }
.auth-form.active { display: grid; gap: 15px; }
label { display: grid; gap: 8px; color: var(--muted); font-size: .9rem; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  background: var(--input-bg);
  color: var(--text);
  outline: none;
  min-height: 48px;
}
select option { background: var(--card); }
input:focus, select:focus, textarea:focus { border-color: rgba(31,122,140,.48); box-shadow: 0 0 0 4px rgba(31,122,140,.09); }

.hero {
  min-height: calc(100vh - 125px);
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 42px;
  align-items: center;
}
.eyebrow { margin: 0; color: var(--primary); text-transform: uppercase; letter-spacing: 2px; font-size: .72rem; font-weight: 700; }
.search-panel, .filters { display: flex; gap: 12px; padding: 12px; border-radius: var(--radius); margin: 28px 0 18px; }
.search-panel input, .filters input, .filters select { background: var(--input-bg); }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
}
.chip.active, .chip:hover { background: rgba(31,122,140,.08); border-color: rgba(31,122,140,.22); color: var(--primary); }
.hero-visual {
  min-height: 430px;
  border-radius: 18px;
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.hero-visual:before {
  content: "";
  position: absolute;
  inset: 28px;
  border-radius: 16px;
  background: url("https://images.unsplash.com/photo-1492684223066-81342ee5ff30?auto=format&fit=crop&w=1000&q=80") center/cover;
  opacity: .45;
  filter: var(--hero-filter);
}
.pulse-card { position: relative; z-index: 1; width: min(310px, 80%); padding: 24px; border-radius: 16px; background: var(--glass-bg); border: 1px solid var(--line); box-shadow: var(--shadow); animation: float 3.8s ease-in-out infinite; }
.pulse-card span, .pulse-card small { color: var(--muted); display: block; }
.pulse-card strong { display: block; font-size: 1.6rem; margin: 8px 0; }
.orbit { position: absolute; border: 1px solid var(--orbit-line); border-radius: 50%; animation: spin 18s linear infinite; }
.orbit.one { width: 260px; height: 260px; }
.orbit.two { width: 380px; height: 380px; animation-direction: reverse; }

.section-head, .compact-hero { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin: 44px 0 20px; }
.compact-hero { display: block; padding-top: 28px; }
.compact-hero h1 { font-size: clamp(2rem, 6vw, 4.1rem); }
.event-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; padding-bottom: 38px; }
.event-card, .ticket-card, .gallery-item, .metric-card, .admin-event-row {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--glass-bg);
  overflow: hidden;
  transition: transform .22s ease, border-color .22s ease;
}
.event-card:hover, .gallery-item:hover { transform: translateY(-5px); border-color: rgba(31,122,140,.22); }
.event-card img { height: 205px; object-fit: cover; }
.event-body { padding: 18px; }
.event-meta { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: .88rem; }
.badge { display: inline-flex; border-radius: 999px; padding: 7px 10px; background: rgba(31,122,140,.08); color: var(--primary); font-size: .8rem; border: 1px solid rgba(31,122,140,.18); }
.event-body h3 { margin: 12px 0 8px; font-size: 1.15rem; }
.event-body p { color: var(--muted); min-height: 50px; }
.event-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; }
.price { font-weight: 800; color: var(--secondary); }

.detail-banner { height: 430px; border-radius: 24px; object-fit: cover; margin-top: 30px; }
.detail-panel { display: grid; grid-template-columns: 1fr 310px; gap: 22px; margin: 24px 0 40px; }
.detail-copy, .detail-aside { padding: 24px; border-radius: var(--radius); }
.detail-copy p, .empty-state { color: var(--muted); }
.detail-list { display: grid; gap: 12px; margin-top: 18px; color: var(--muted); }
.detail-list strong { color: var(--text); }

.modal { position: fixed; inset: 0; z-index: 40; display: none; place-items: center; background: rgba(0,0,0,.62); padding: 20px; }
.modal.show { display: grid; }
.modal-card { width: min(430px, 100%); padding: 30px; border-radius: 20px; text-align: center; animation: pop .3s ease both; }

.ticket-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; padding-bottom: 44px; }
.ticket-card { padding: 20px; display: grid; grid-template-columns: 1fr 130px; gap: 18px; align-items: center; }
.ticket-card p { color: var(--muted); margin: 6px 0; }
.qr { background: #fff; padding: 10px; border-radius: 14px; }

.masonry { columns: 3 260px; column-gap: 18px; padding-bottom: 40px; }
.gallery-item { break-inside: avoid; margin: 0 0 18px; }
.gallery-item img { height: auto; min-height: 220px; object-fit: cover; transition: transform .35s ease; }
.gallery-item:hover img { transform: scale(1.08); }

.feature-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.feature-row span { padding: 12px 14px; border-radius: 999px; background: var(--soft); border: 1px solid var(--line); }
.profile-card { margin-top: 42px; text-align: center; }
.avatar { width: 96px; height: 96px; margin: 0 auto 16px; border-radius: 24px; display: grid; place-items: center; font-size: 2rem; font-weight: 800; background: linear-gradient(135deg, var(--primary), #5BB7A6); color: #ffffff; }

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 14px;
  z-index: 30;
  transform: translateX(-50%);
  width: min(520px, calc(100% - 24px));
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--bottom-bg);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}
.bottom-nav a { text-align: center; color: var(--muted); padding: 10px 6px; border-radius: 16px; font-size: .78rem; }
.bottom-nav a.active { color: var(--tab-text); background: var(--tab-bg); }

.toast {
  position: fixed;
  right: 18px;
  bottom: 22px;
  z-index: 60;
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  padding: 14px 16px;
  border-radius: 15px;
  background: var(--toast-bg);
  border: 1px solid var(--line);
  transition: .25s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }

.admin-layout { min-height: 100vh; display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 22px; padding: 18px; }
.admin-sidebar { border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 12px; position: sticky; top: 18px; height: calc(100vh - 36px); }
.admin-sidebar a { padding: 13px 14px; border-radius: 14px; color: var(--muted); }
.admin-sidebar a:hover { background: var(--soft); color: var(--text); }
.admin-login { width: min(480px, 100%); align-self: center; justify-self: center; padding: 28px; border-radius: 18px; }
.admin-main { display: none; }
.admin-main.active { display: block; }
.admin-head { display: flex; justify-content: space-between; align-items: center; margin: 14px 0 18px; }
.analytics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.metric-card { padding: 18px; }
.metric-card strong { font-size: 1.7rem; display: block; }
.metric-card span { color: var(--muted); }
.admin-grid { display: grid; grid-template-columns: minmax(320px, 420px) minmax(0, 1fr); gap: 18px; margin-top: 18px; }
.admin-table { padding: 20px; border-radius: var(--radius); overflow: auto; }
.admin-event-row { display: grid; grid-template-columns: 80px 1fr auto; gap: 14px; align-items: center; padding: 12px; margin-bottom: 12px; }
.admin-event-row img { width: 80px; height: 58px; object-fit: cover; border-radius: 12px; }
.row-actions { display: flex; gap: 8px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pop { from { opacity: 0; transform: scale(.88); } to { opacity: 1; transform: scale(1); } }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }
@keyframes float { 50% { transform: translateY(-14px); } }

@media (max-width: 960px) {
  body { padding-bottom: 92px; }
  .container, .narrow { width: min(100% - 28px, 760px); }
  .auth-shell, .hero, .detail-panel, .admin-layout, .admin-grid { grid-template-columns: 1fr; }
  .auth-shell { min-height: auto; padding: 78px 0 32px; }
  .hero { min-height: auto; padding: 34px 0 12px; }
  .hero-visual { min-height: 360px; order: -1; }
  .hero h1 { font-size: clamp(2.3rem, 9vw, 4.4rem); }
  .admin-layout { padding: 14px; gap: 14px; }
  .admin-sidebar { position: static; height: auto; display: grid; grid-template-columns: 1fr 1fr; align-items: center; }
  .admin-sidebar .brand { grid-column: 1 / -1; }
  .admin-sidebar .btn { width: 100%; }
  .admin-login { margin: 24px auto; }
  .event-grid, .analytics { grid-template-columns: repeat(2, 1fr); }
  .nav-links { display: none; }
  .bottom-nav { display: grid; }
  .topbar { gap: 10px; }
  .user-area { gap: 8px; }
  .theme-toggle { min-width: 76px; }
}

@media (max-width: 640px) {
  body { padding-bottom: calc(94px + env(safe-area-inset-bottom)); }
  .container, .narrow { width: calc(100% - 24px); }
  .topbar { padding: 10px 12px; }
  .brand { gap: 10px; }
  .brand span, .brand-mark { width: 40px; height: 40px; border-radius: 12px; }
  .brand strong { font-size: .96rem; }
  .user-pill { display: none; }
  .topbar .btn { padding: 10px 11px; min-height: 40px; border-radius: 11px; font-size: .88rem; }
  .topbar .theme-toggle { min-width: 64px; }
  .auth-theme { top: 12px; right: 12px; }
  .auth-shell { width: calc(100% - 24px); padding: 72px 0 26px; gap: 20px; }
  .auth-card, .form-card, .profile-card, .info-page { padding: 20px; }
  .auth-brand h1, .hero h1 { font-size: clamp(2.35rem, 13vw, 3.15rem); }
  .auth-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .auth-stats div { min-width: 0; padding: 12px; }
  .auth-stats strong { font-size: 1.05rem; }
  .hero { min-height: auto; padding: 24px 0 8px; gap: 22px; }
  .hero-visual { min-height: 260px; }
  .hero-visual:before { inset: 16px; }
  .pulse-card { width: calc(100% - 54px); padding: 18px; }
  .pulse-card strong { font-size: 1.25rem; }
  .search-panel, .filters { flex-direction: column; }
  .search-panel { margin-top: 22px; }
  .filters { padding: 10px; }
  .section-head { align-items: start; }
  .event-grid, .ticket-grid, .analytics { grid-template-columns: 1fr; }
  .event-grid { gap: 14px; }
  .event-card img { height: 190px; }
  .event-body { padding: 16px; }
  .ticket-card { grid-template-columns: 1fr; }
  .ticket-card .qr { width: 132px; }
  .detail-banner { height: 260px; }
  .detail-copy, .detail-aside { padding: 18px; }
  .detail-copy h1, .compact-hero h1 { font-size: clamp(2rem, 11vw, 2.8rem); }
  .masonry { columns: 1; }
  .gallery-item img { min-height: 210px; }
  .admin-layout { padding: 10px; }
  .admin-sidebar { grid-template-columns: 1fr 1fr; padding: 14px; }
  .admin-sidebar a, .admin-sidebar .btn { padding: 11px 12px; font-size: .9rem; }
  .admin-login { padding: 22px; margin: 12px auto; }
  .admin-head { align-items: start; }
  .admin-table { padding: 14px; }
  .admin-event-row { grid-template-columns: 64px 1fr; }
  .admin-event-row img { width: 64px; height: 54px; }
  .row-actions { grid-column: 1 / -1; }
  .row-actions .btn { flex: 1; }
  .bottom-nav { bottom: max(10px, env(safe-area-inset-bottom)); width: calc(100% - 18px); padding: 8px; border-radius: 20px; }
  .bottom-nav a { min-height: 44px; display: grid; place-items: center; }
  .toast { left: 12px; right: 12px; bottom: calc(98px + env(safe-area-inset-bottom)); }
}

@media (max-width: 420px) {
  .topbar .btn[href="admin.html"] { display: none; }
  .hero-visual { min-height: 230px; }
  .event-card img { height: 170px; }
  .auth-stats { grid-template-columns: 1fr; }
  .admin-sidebar { grid-template-columns: 1fr; }
  .admin-event-row { grid-template-columns: 1fr; }
  .admin-event-row img { width: 100%; height: 150px; }
}
