/* ============================================================
   AMET TICKETS — Main Stylesheet
   Deep Purple & White Luxury Aesthetic
   Fonts: Cormorant Garamond (display) + DM Sans (body)
   ============================================================ */

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

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --purple-darkest: #1a0033;
  --purple-dark:    #2d0057;
  --purple-primary: #4a148c;
  --purple-mid:     #6a1b9a;
  --purple-light:   #7b1fa2;
  --purple-soft:    #9c27b0;
  --purple-pale:    #e8d5f5;
  --purple-ghost:   #f5eeff;
  --gold:           #d4a843;
  --gold-light:     #f0cd7a;
  --white:          #ffffff;
  --off-white:      #faf8ff;
  --text-dark:      #1a1a2e;
  --text-mid:       #4a4a6a;
  --text-light:     #8888aa;
  --border:         #e0d0f5;
  --shadow-sm:      0 2px 8px rgba(74,20,140,0.1);
  --shadow-md:      0 8px 30px rgba(74,20,140,0.15);
  --shadow-lg:      0 20px 60px rgba(74,20,140,0.2);
  --radius-sm:      8px;
  --radius-md:      14px;
  --radius-lg:      24px;
  --transition:     all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --surface:        #ffffff;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--off-white);
  color: var(--text-dark);
  line-height: 1.6;
  font-size: 15px;
}
/* Admin pages: body bg set inline in admin/header.php */

/* ── Typography ────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  line-height: 1.2;
  color: var(--purple-primary);
}
h1 { font-size: clamp(28px, 5vw, 48px); }
h2 { font-size: clamp(22px, 4vw, 36px); }
h3 { font-size: clamp(18px, 3vw, 26px); }
a { color: var(--purple-light); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--purple-primary); }

/* ── Layout ─────────────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; box-sizing: border-box; width: 100%; }
.page-wrapper { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }

/* ── Navbar ─────────────────────────────────────────────────── */
.navbar {
  display: block; /* explicit — overrides any inherited display:none */
  background: var(--purple-darkest);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  width: 100%;
}
.navbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 68px; max-width: 1200px; margin: 0 auto;
}
.navbar-brand {
  display: flex; align-items: center; gap: 12px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px; font-weight: 700;
  color: var(--white); letter-spacing: 1px;
}
.navbar-brand span { color: var(--gold); }
.navbar-brand .logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--purple-soft), var(--gold));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.navbar-nav { display: flex; align-items: center; gap: 8px; }
.navbar-nav a {
  color: rgba(255,255,255,0.75); padding: 8px 16px;
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 500;
  transition: var(--transition);
}
.navbar-nav a:hover { color: var(--white); background: rgba(255,255,255,0.1); }
.navbar-nav a.active { color: var(--gold); }
.navbar-nav .btn-nav {
  background: var(--purple-light); color: var(--white);
  padding: 8px 20px; border-radius: 24px;
}
.navbar-nav .btn-nav:hover { background: var(--purple-soft); }
.navbar-menu-toggle { display: none; background: none; border: none; color: white; font-size: 24px; cursor: pointer; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 28px; border-radius: 50px;
  font-family: 'DM Sans', sans-serif; font-size: 14px; font-weight: 600;
  cursor: pointer; border: 2px solid transparent;
  transition: var(--transition); text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--purple-primary), var(--purple-soft));
  color: var(--white);
  box-shadow: 0 4px 15px rgba(74,20,140,0.4);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(74,20,140,0.5);
  color: var(--white);
}
.btn-outline {
  background: transparent; color: var(--purple-primary);
  border-color: var(--purple-primary);
}
.btn-outline:hover { background: var(--purple-primary); color: var(--white); }
.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: var(--purple-darkest); border-color: transparent;
  box-shadow: 0 4px 15px rgba(212,168,67,0.4);
}
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(212,168,67,0.5); }
.btn-danger { background: #c62828; color: white; }
.btn-danger:hover { background: #b71c1c; }
.btn-sm { padding: 8px 18px; font-size: 13px; }
.btn-lg { padding: 16px 40px; font-size: 16px; }
.btn-block { width: 100%; justify-content: center; border-radius: var(--radius-sm); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden; transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card-header {
  padding: 20px 28px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-body { padding: 28px; }
.card-footer { padding: 16px 28px; border-top: 1px solid var(--border); background: var(--purple-ghost); }

/* ── Event Cards ─────────────────────────────────────────────── */
.event-card {
  background: var(--white); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: var(--transition);
  display: flex; flex-direction: column;
}
.event-card:hover { box-shadow: var(--shadow-md); transform: translateY(-4px); }
.event-card-image {
  width: 100%; height: 200px; object-fit: cover;
  background: linear-gradient(135deg, var(--purple-dark), var(--purple-soft));
  display: flex; align-items: center; justify-content: center;
  font-size: 48px; color: rgba(255,255,255,0.4);
}
.event-card-image img { width: 100%; height: 100%; object-fit: cover; }
.event-card-body { padding: 22px; flex: 1; }
.event-card-type {
  font-size: 11px; text-transform: uppercase; letter-spacing: 2px;
  color: var(--purple-soft); font-weight: 600; margin-bottom: 8px;
}
.event-card-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px; color: var(--text-dark); font-weight: 700;
  margin-bottom: 10px; line-height: 1.3;
}
.event-card-meta { font-size: 13px; color: var(--text-light); margin-bottom: 16px; }
.event-card-meta span { display: block; margin-bottom: 4px; }
.event-card-footer {
  padding: 16px 22px;
  display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--border);
}
.price-from { font-size: 13px; color: var(--text-light); }
.price-amount { font-size: 18px; font-weight: 700; color: var(--purple-primary); }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 22px; }
.form-label {
  display: block; margin-bottom: 8px;
  font-size: 13px; font-weight: 600;
  color: var(--text-mid); letter-spacing: 0.5px;
  text-transform: uppercase;
}
.form-control {
  width: 100%; padding: 12px 16px;
  border: 2px solid var(--border); border-radius: var(--radius-sm);
  background: var(--white); color: var(--text-dark);
  font-family: 'DM Sans', sans-serif; font-size: 15px;
  transition: var(--transition);
  appearance: none;
}
.form-control:focus {
  outline: none; border-color: var(--purple-light);
  box-shadow: 0 0 0 4px rgba(123,31,162,0.1);
}
.form-control::placeholder { color: var(--text-light); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%234a148c' d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
.form-hint { font-size: 12px; color: var(--text-light); margin-top: 5px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
  padding: 14px 20px; border-radius: var(--radius-sm);
  margin-bottom: 20px; font-size: 14px;
  display: flex; align-items: flex-start; gap: 10px;
}
.alert::before { font-size: 16px; }
.alert-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.alert-success::before { content: '✓'; }
.alert-error { background: #fce4ec; color: #c62828; border: 1px solid #f8bbd0; }
.alert-error::before { content: '✕'; }
.alert-info { background: var(--purple-ghost); color: var(--purple-primary); border: 1px solid var(--purple-pale); }
.alert-info::before { content: 'ℹ'; }
.alert-warning { background: #fff8e1; color: #f57f17; border: 1px solid #ffe082; }
.alert-warning::before { content: '⚠'; }

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--purple-ghost); }
thead th {
  padding: 14px 18px; text-align: left;
  font-size: 12px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--purple-primary); font-weight: 700; white-space: nowrap;
}
tbody tr { border-top: 1px solid var(--border); transition: var(--transition); }
tbody tr:hover { background: var(--purple-ghost); }
tbody td { padding: 14px 18px; font-size: 14px; color: var(--text-dark); }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 12px; border-radius: 20px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
  text-transform: uppercase;
}
.badge-purple { background: var(--purple-pale); color: var(--purple-primary); }
.badge-gold { background: #fff3cd; color: #b8860b; }
.badge-green { background: #e8f5e9; color: #2e7d32; }
.badge-red { background: #fce4ec; color: #c62828; }
.badge-gray { background: #f5f5f5; color: #757575; }
.badge-blue { background: #e3f2fd; color: #1565c0; }

/* ── Page Hero ──────────────────────────────────────────────── */
.page-hero {
  background: linear-gradient(135deg, var(--purple-darkest) 0%, var(--purple-primary) 60%, var(--purple-soft) 100%);
  padding: 60px 24px;
  position: relative; overflow: hidden;
}
.page-hero::before {
  content: ''; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='30' cy='30' r='1' fill='rgba(255,255,255,0.05)'/%3E%3C/svg%3E");
}
.page-hero-content { position: relative; max-width: 1200px; margin: 0 auto; }
.page-hero h1 { color: var(--white); margin-bottom: 10px; }
.page-hero p { color: rgba(255,255,255,0.7); font-size: 16px; }

/* ── Seat Map ────────────────────────────────────────────────── */
/* ── Seat Map — Cinematic Style ──────────────────────────── */
.seat-map-container {
  overflow-x: auto;
  overflow-y: visible;
  padding: 20px 0 20px 0;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  overscroll-behavior-x: contain;
  position: relative;
  display: block;
  width: 100%;
  /* GPU compositing layer — helps Chrome recognise scroll region */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  /* Prevent parent from clipping us */
  isolation: isolate;
}
.seat-map-container .seat-map,
.seat-map-container .seat-map-small {
  min-width: max-content;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
}
.seat-map { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.seat-row { display: flex; align-items: flex-end; gap: 5px; margin-bottom: 2px; }
.seat-row-label {
  width: 26px; text-align: center;
  font-size: 11px; font-weight: 700; color: rgba(255,255,255,0.35);
  font-family: monospace; flex-shrink: 0; padding-bottom: 4px;
}
/* Cinema seat — realistic chair shape */
.seat {
  width: 30px; height: 34px;
  position: relative; cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
  flex-shrink: 0;
}
.seat svg { width: 100%; height: 100%; display: block; }
.seat:hover:not(.seat-no-grade):not(.seat-reserved):not(.seat-booked):not(.seat-selecting) {
  transform: scale(1.18) translateY(-2px); z-index: 10; filter: brightness(1.2);
}
/* Walkway / aisle gap */
.seat-aisle {
  width: 18px; height: 32px;
  flex-shrink: 0;
  cursor: default;
}
/* ── SVG seat colours ─────────────────────────────────────── */
/* --gc  = base grade colour (set inline by PHP)
   --gc2 = 20% darker shade (back panel depth)
   --gc3 = 40% darker shade (base/armrest depth)
   PHP sets all three on each seat div for full cross-browser support. */

/* AVAILABLE — grade colour, shaded parts use darker vars */
.seat-map .seat-available .seat-back    { fill: var(--gc,  #16a34a); }
.seat-map .seat-available .seat-cushion { fill: var(--gc2, #15803d); }
.seat-map .seat-available .seat-base    { fill: var(--gc3, #166534); }
.seat-map .seat-available .seat-armrest { fill: var(--gc3, #14532d); }

/* SELECTED — white/grey to clearly show user's pick */
.seat-map .seat-selected .seat-back    { fill: #f0f0f0 !important; }
.seat-map .seat-selected .seat-cushion  { fill: #d0d0d0 !important; }
.seat-map .seat-selected .seat-base    { fill: #b0b0b0 !important; }
.seat-map .seat-selected .seat-armrest  { fill: #989898 !important; }

/* BOOKED / TAKEN — red (--gc forced to red by PHP) */
.seat-map .seat-booked .seat-back      { fill: var(--gc,  #dc2626); }
.seat-map .seat-booked .seat-cushion    { fill: var(--gc2, #b91c1c); }
.seat-map .seat-booked .seat-base      { fill: var(--gc3, #991b1b); }
.seat-map .seat-booked .seat-armrest    { fill: var(--gc3, #7f1d1d); }
.seat-map .seat-booked { cursor: not-allowed; opacity: 0.9; }

/* RESERVED — amber (temporarily held, --gc forced by PHP) */
.seat-map .seat-reserved .seat-back    { fill: var(--gc,  #d97706); }
.seat-map .seat-reserved .seat-cushion  { fill: var(--gc2, #b45309); }
.seat-map .seat-reserved .seat-base    { fill: var(--gc3, #92400e); }
.seat-map .seat-reserved .seat-armrest  { fill: var(--gc3, #78350f); }
.seat-map .seat-reserved { cursor: not-allowed; }

/* NO GRADE ASSIGNED — dark grey */
.seat-map .seat-no-grade .seat-back    { fill: #374151; }
.seat-map .seat-no-grade .seat-cushion  { fill: #2d3748; }
.seat-map .seat-no-grade .seat-base    { fill: #1f2937; }
.seat-map .seat-no-grade .seat-armrest  { fill: #1a202c; }
.seat-map .seat-no-grade { cursor: not-allowed; opacity: 0.4; }
/* Selecting (waiting for API) */
.seat-selecting { animation: seatPulse 0.6s ease infinite; cursor: wait !important; }
/* Selected pop animation */
.seat-selected-pop .seat-back { animation: seatPop 0.4s cubic-bezier(0.34,1.56,0.64,1); }
@keyframes seatPulse { 0%,100%{opacity:0.6} 50%{opacity:1} }

/* Small seats for venues with >20 columns */
.seat-map-small .seat { width: 20px; height: 23px; }
.seat-map-small .seat-aisle { width: 12px; }
.seat-map-small .seat-row { gap: 3px; }
.seat-map-small .seat-row-label { font-size: 9px; min-width: 14px; }
@keyframes seatPop   { 0%{transform:scale(1)} 50%{transform:scale(1.3)} 100%{transform:scale(1)} }

/* Cinema screen */
.cinema-screen {
  width: 72%; max-width: 520px;
  margin: 0 auto 36px;
  position: relative;
}
.cinema-screen-surface {
  height: 10px;
  background: linear-gradient(to bottom, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0.1) 100%);
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  box-shadow: 0 0 40px rgba(255,255,255,0.25), 0 0 80px rgba(255,255,255,0.1);
}
.cinema-screen-label {
  text-align: center; font-size: 10px; letter-spacing: 4px;
  text-transform: uppercase; color: rgba(255,255,255,0.3);
  margin-top: 8px; font-family: monospace;
}
/* Legacy screen-label support */
.screen-label {
  width: 70%; background: linear-gradient(to bottom, rgba(255,255,255,0.6), transparent);
  height: 8px; border-radius: 50% 50% 0 0 / 100% 100% 0 0; margin-bottom: 20px;
  box-shadow: 0 0 30px rgba(255,255,255,0.2);
}
.screen-label::after {
  content: 'SCREEN'; position: absolute; top: -22px; left: 50%;
  transform: translateX(-50%); font-size: 9px; color: rgba(255,255,255,0.3);
  letter-spacing: 4px; white-space: nowrap;
}
.seat-legend {
  display: flex; flex-wrap: wrap; gap: 14px;
  justify-content: center; margin-top: 24px; padding: 14px 20px;
  background: rgba(255,255,255,0.03); border-radius: var(--radius-md);
  border: 1px solid rgba(255,255,255,0.07);
}
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: rgba(255,255,255,0.6); }
/* Legacy legend color swatch — used where SVG seats aren't shown */
.legend-color { width: 16px; height: 16px; border-radius: 4px; flex-shrink: 0; display: inline-block; }
.legend-seat {
  width: 20px; height: 23px; position: relative; flex-shrink: 0;
}
.legend-seat svg { width: 100%; height: 100%; }

/* ── Ticket Stub ─────────────────────────────────────────────── */
.ticket-stub {
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-md);
  max-width: 500px; position: relative;
}
.ticket-stub::before {
  content: ''; position: absolute;
  left: 0; right: 0; top: 50%; transform: translateY(-50%);
  border-top: 3px dashed var(--purple-pale);
  z-index: 0;
}
.ticket-stub-top {
  background: linear-gradient(135deg, var(--purple-darkest), var(--purple-light));
  padding: 30px; color: white; position: relative;
}
.ticket-stub-top::after {
  content: '';
  position: absolute; bottom: -20px; left: -15px;
  width: 30px; height: 30px;
  background: var(--off-white); border-radius: 50%;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}
.ticket-stub-top::before {
  content: '';
  position: absolute; bottom: -20px; right: -15px;
  width: 30px; height: 30px;
  background: var(--off-white); border-radius: 50%;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}
.ticket-stub-bottom { padding: 30px; position: relative; }
.ticket-code-display {
  font-family: monospace; font-size: 20px; letter-spacing: 4px;
  color: var(--purple-primary); font-weight: 700; text-align: center;
  padding: 12px; background: var(--purple-ghost); border-radius: var(--radius-sm);
}
.qr-code-wrapper { text-align: center; padding: 16px 0; }
.qr-code-wrapper img { border: 6px solid var(--purple-pale); border-radius: 12px; }

/* ── Admin Sidebar ──────────────────────────────────────────── */
.admin-layout { display: flex; min-height: calc(100vh - 68px); background: #0e0020; }
.admin-sidebar {
  width: 260px; background: #130030;
  flex-shrink: 0;
  position: sticky; top: 68px; height: calc(100vh - 68px); overflow-y: auto; overflow-x: hidden;
  border-right: 1px solid rgba(255,255,255,0.06);
  transition: width 0.25s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
}
/* ── Collapsed state ── */
.admin-sidebar.sidebar-collapsed { width: 60px; }
.admin-sidebar.sidebar-collapsed .sidebar-section-label,
.admin-sidebar.sidebar-collapsed .sidebar-nav a span:not(.icon),
.admin-sidebar.sidebar-collapsed .sidebar-user-name,
.admin-sidebar.sidebar-collapsed .sidebar-user-org,
.admin-sidebar.sidebar-collapsed .sidebar-mini-stats { display: none; }
.admin-sidebar.sidebar-collapsed .sidebar-nav a {
  padding: 12px 0; justify-content: center; border-left: none; border-radius: 0;
}
.admin-sidebar.sidebar-collapsed .sidebar-nav a .icon { width: auto; font-size: 20px; }
.admin-sidebar.sidebar-collapsed .sidebar-nav a:hover,
.admin-sidebar.sidebar-collapsed .sidebar-nav a.active {
  background: rgba(255,255,255,0.08); border-left: 3px solid var(--gold);
}
.admin-sidebar.sidebar-collapsed .sidebar-section { padding: 6px 0; }
.admin-sidebar.sidebar-collapsed .sidebar-toggle-btn { justify-content: center; }
/* ── Toggle button ── */
.sidebar-toggle-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 20px; cursor: pointer; user-select: none;
  color: rgba(255,255,255,0.4); font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  transition: color .2s, background .2s;
  flex-shrink: 0;
}
.sidebar-toggle-btn:hover { color: rgba(255,255,255,0.8); background: rgba(255,255,255,.04); }
.sidebar-toggle-icon { font-size: 18px; transition: transform 0.25s; }
.admin-sidebar.sidebar-collapsed .sidebar-toggle-icon { transform: rotate(180deg); }
/* ── Nav items ── */
.sidebar-section { padding: 8px 0; margin-bottom: 4px; }
.sidebar-section-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 2px;
  color: rgba(255,255,255,0.3); margin-bottom: 6px; padding: 0 24px;
  white-space: nowrap; overflow: hidden;
}
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 24px; color: rgba(255,255,255,0.65);
  font-size: 14px; font-weight: 500; transition: background .15s, color .15s;
  border-left: 3px solid transparent; white-space: nowrap;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  color: var(--white); background: rgba(255,255,255,0.07);
  border-left-color: var(--gold);
}
.sidebar-nav a .icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
/* ── Main content area ── */
.admin-main { flex: 1; padding: 32px; overflow-x: hidden; background: #0e0020; color: rgba(255,255,255,0.85); min-width: 0; transition: none; }
.admin-page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px;
}
.admin-page-header h2 { color: #fff; margin: 0; }


/* ── Stats Cards ─────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 32px; }
.admin-main .card { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.08); color: rgba(255,255,255,0.85); }
.admin-main .card-header { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.07); }
.admin-main .card-header h3, .admin-main .card-header h2 { color: #fff; }
.admin-main table thead tr { background: rgba(255,255,255,0.04); }
.admin-main table thead th { color: rgba(255,255,255,0.4); border-color: rgba(255,255,255,0.07); }
.admin-main table tbody tr { border-color: rgba(255,255,255,0.05); color: rgba(255,255,255,0.75); }
.admin-main table tbody tr:hover { background: rgba(255,255,255,0.03); }
.admin-main table tbody td { color: rgba(255,255,255,0.75); border-color: rgba(255,255,255,0.05); }
.admin-main .form-control, .admin-main .form-label { color: rgba(255,255,255,0.8); }
.admin-main .form-control { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.12); }
.admin-main .form-control:focus { border-color: var(--gold); background: rgba(255,255,255,0.09); }
.admin-main label { color: rgba(255,255,255,0.6); }
.admin-main select.form-control option { background: #1a0033; color: #fff; }
.stat-card {
  background: var(--white); padding: 24px; border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
  border-left: 4px solid var(--purple-primary);
  transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
/* Compact stat card variant */
.stat-card-compact { padding: 14px 16px !important; }
.stat-card-compact .stat-icon-sm { font-size: 20px; margin-bottom: 5px; }
.stat-card-compact .stat-value-sm { font-size: 22px; font-weight: 700; line-height: 1.1; }
.stat-card-compact .stat-label-sm { font-size: 11px; color: var(--text-light); margin-top: 2px; text-transform: uppercase; letter-spacing: .4px; }
.stat-card-compact .stat-sub-sm { font-size: 10px; color: var(--text-light); opacity: .7; margin-top: 2px; }
.stat-card-compact .stat-drill { font-size: 10px; color: var(--purple-primary); margin-top: 5px; opacity: .75; }
.stat-card-clickable { cursor: pointer; }
.stat-card-clickable:hover { transform: translateY(-3px) !important; box-shadow: 0 6px 24px rgba(0,0,0,.18) !important; border-left-width: 5px !important; }
.stat-card-clickable:hover .stat-drill { opacity: 1; color: var(--gold); }
#stat-modal-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,.65); z-index:9000; align-items:center; justify-content:center; padding:20px; }
#stat-modal-overlay.open { display:flex; }
#stat-modal-box { background:var(--white); border-radius:var(--radius-lg); max-width:520px; width:100%; max-height:80vh; overflow-y:auto; box-shadow:0 24px 64px rgba(0,0,0,.5); }
#stat-modal-box .sm-head { padding:20px 24px 16px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; }
#stat-modal-box .sm-head h3 { margin:0; font-size:16px; }
#stat-modal-box .sm-close { font-size:22px; background:none; border:none; cursor:pointer; color:var(--text-light); padding:0 4px; }
#stat-modal-box .sm-body { padding:20px 24px; }
.sm-row { display:flex; align-items:center; justify-content:space-between; padding:8px 0; border-bottom:1px solid rgba(255,255,255,.05); font-size:13px; }
.sm-row:last-child { border-bottom:none; }
.sm-row-label { color:rgba(255,255,255,.65); }
.sm-row-value { font-weight:700; color:#fff; }
.stat-card .stat-icon { font-size: 28px; margin-bottom: 12px; }
.stat-card .stat-value { font-size: 30px; font-weight: 700; color: var(--purple-primary); font-family: 'Cormorant Garamond', serif; }
.stat-card .stat-label { font-size: 13px; color: var(--text-light); margin-top: 4px; }

/* ── Auth Pages ─────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--purple-darkest) 0%, var(--purple-primary) 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 40px 20px;
}
.auth-card {
  width: 100%; max-width: 460px;
  background: var(--white); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-lg);
}
.auth-card-header {
  background: linear-gradient(135deg, var(--purple-primary), var(--purple-soft));
  padding: 40px; text-align: center; color: white;
}
.auth-logo { font-family: 'Cormorant Garamond', serif; font-size: 28px; font-weight: 700; letter-spacing: 2px; }
.auth-logo span { color: var(--gold); }
.auth-card-body { padding: 36px; }
.auth-divider {
  text-align: center; position: relative; margin: 20px 0;
  font-size: 13px; color: var(--text-light);
}
.auth-divider::before, .auth-divider::after {
  content: ''; position: absolute; top: 50%; width: 42%; height: 1px; background: var(--border);
}
.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }

/* ── Checkout ────────────────────────────────────────────────── */
.checkout-layout { display: grid; grid-template-columns: 1fr 380px; gap: 28px; align-items: start; }
.checkout-summary {
  background: var(--purple-ghost); border-radius: var(--radius-lg);
  padding: 28px; border: 1px solid var(--purple-pale);
  position: sticky; top: 88px;
}
.summary-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--purple-pale); font-size: 14px; }
.summary-item:last-child { border-bottom: none; }
/* Prevent checkout overflow on mobile */
.checkout-layout, .checkout-layout > * { min-width: 0; }
.summary-total { font-size: 18px; font-weight: 700; color: var(--purple-primary); padding-top: 12px; }
.selected-seats-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.selected-seat-chip {
  background: var(--purple-primary); color: white;
  padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
}

/* ── Verify page ─────────────────────────────────────────────── */
.verify-result {
  max-width: 500px; margin: 60px auto; text-align: center;
  padding: 48px 40px; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.verify-valid { background: #e8f5e9; border: 2px solid #4caf50; }
.verify-invalid { background: #fce4ec; border: 2px solid #f44336; }
.verify-used { background: #fff8e1; border: 2px solid #ff9800; }
.verify-icon { font-size: 72px; margin-bottom: 20px; display: block; }

/* ── Section ─────────────────────────────────────────────────── */
.section { padding: 60px 0; }
.section-title {
  font-family: 'Cormorant Garamond', serif; font-size: 36px;
  color: var(--text-dark); margin-bottom: 8px;
}
.section-subtitle { color: var(--text-light); font-size: 16px; margin-bottom: 40px; }

/* ── Events Grid ─────────────────────────────────────────────── */
.events-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 28px; }

/* ── Timer ───────────────────────────────────────────────────── */
.reservation-timer {
  background: #fff3e0; border: 2px solid #ff9800;
  border-radius: var(--radius-sm); padding: 12px 20px;
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px; font-size: 14px;
}
#timer-display { font-weight: 700; font-size: 18px; color: #e65100; font-family: monospace; }
.timer-warning { background: rgba(255,152,0,0.15) !important; border-color: #ff9800 !important; }
.timer-warning #timer-display { color: #f57c00 !important; }
.timer-critical { background: rgba(244,67,54,0.15) !important; border-color: #f44336 !important; }
.timer-critical #timer-display { color: #c62828 !important; animation: timerPulse 0.5s infinite; }
@keyframes timerPulse { 0%,100%{opacity:1} 50%{opacity:.4} }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.5; } }

/* ── My Tickets ─────────────────────────────────────────────── */
.ticket-list-item {
  display: flex; gap: 20px; align-items: stretch;
  background: var(--white); border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
  overflow: hidden; transition: var(--transition);
  margin-bottom: 16px;
}
.ticket-list-item:hover { box-shadow: var(--shadow-md); }
.ticket-list-stripe {
  width: 8px; flex-shrink: 0;
  background: linear-gradient(to bottom, var(--purple-primary), var(--purple-soft));
}
.ticket-list-body { padding: 20px; flex: 1; }
.ticket-list-meta { display: flex; gap: 20px; flex-wrap: wrap; font-size: 13px; color: var(--text-light); margin-top: 8px; }
.ticket-list-actions { padding: 20px; display: flex; align-items: center; gap: 10px; }

/* ── Footer ─────────────────────────────────────────────────── */
footer {
  display: block;
  background: var(--purple-darkest); color: rgba(255,255,255,0.6);
  padding: 48px 24px 24px; margin-top: auto;
}
.footer-inner { max-width: 1200px; margin: 0 auto; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 40px; }
.footer-brand { font-family: 'Cormorant Garamond', serif; font-size: 24px; color: white; font-weight: 700; margin-bottom: 12px; }
.footer-brand span { color: var(--gold); }
.footer-desc { font-size: 14px; line-height: 1.7; }
.footer-heading { color: var(--white); font-size: 13px; text-transform: uppercase; letter-spacing: 2px; font-weight: 700; margin-bottom: 16px; }
.footer-links { list-style: none; }
.footer-links li { margin-bottom: 10px; }
.footer-links a { color: rgba(255,255,255,0.6); font-size: 14px; }
.footer-links a:hover { color: var(--gold); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 24px; display: flex; justify-content: space-between; font-size: 13px; flex-wrap: wrap; gap: 10px; }

/* ── Landing Page ────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--purple-darkest) 0%, var(--purple-dark) 40%, var(--purple-primary) 100%);
  padding: 100px 24px;
  position: relative; overflow: hidden;
  text-align: center;
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 70% 50%, rgba(212,168,67,0.15) 0%, transparent 60%);
}
.hero-content { position: relative; max-width: 760px; margin: 0 auto; }
.hero h1 {
  color: var(--white); font-size: clamp(36px, 6vw, 64px);
  margin-bottom: 20px; line-height: 1.15;
}
.hero h1 em { color: var(--gold); font-style: normal; }
.hero-subtitle { color: rgba(255,255,255,0.75); font-size: 18px; margin-bottom: 40px; max-width: 540px; margin-left: auto; margin-right: auto; }
.hero-btns { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.hero-stats {
  display: flex; justify-content: center; gap: 60px; margin-top: 60px;
  padding-top: 40px; border-top: 1px solid rgba(255,255,255,0.15);
}
.hero-stat-value { font-size: 36px; font-weight: 700; color: var(--gold); font-family: 'Cormorant Garamond', serif; }
.hero-stat-label { font-size: 13px; color: rgba(255,255,255,0.6); }

/* ── Misc ────────────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-muted { color: var(--text-light); }
.text-purple { color: var(--purple-primary); }
.text-gold { color: var(--gold); }
.mt-4 { margin-top: 16px; } .mt-8 { margin-top: 32px; }
.mb-4 { margin-bottom: 16px; } .mb-8 { margin-bottom: 32px; }
.d-flex { display: flex; } .align-center { align-items: center; }
.gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }
.justify-between { justify-content: space-between; }
.w-100 { width: 100%; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-light); }
.empty-state .empty-icon { font-size: 56px; margin-bottom: 16px; }
.empty-state h3 { color: var(--text-mid); margin-bottom: 10px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.loading { text-align: center; padding: 40px; color: var(--text-light); }
.spinner {
  width: 36px; height: 36px; border: 3px solid var(--purple-pale);
  border-top-color: var(--purple-primary); border-radius: 50%;
  animation: spin 0.8s linear infinite; margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .checkout-layout { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .admin-sidebar { display: none; }
  .admin-layout { display: block; }
  .admin-main { padding: 20px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .navbar-nav { display: none; }
  .navbar-menu-toggle { display: block; }
  .hero { padding: 60px 24px; }
  .hero-stats { gap: 30px; }
  .footer-grid { grid-template-columns: 1fr; }
  .events-grid { grid-template-columns: 1fr; }
  /* Checkout mobile */
  .container { padding: 0 14px; }
  .checkout-layout { gap: 16px; }
  .checkout-summary { padding: 18px; position: static; }
  .card-body { padding: 16px; }
  .card-header { padding: 14px 16px; }
  .auth-card-body { padding: 24px; }
  .seat { width: 22px; height: 26px; }
}

/* ── Print (ticket) ─────────────────────────────────────────── */
@media print {
  .navbar, footer, .btn, .no-print { display: none !important; }
  body { background: white; }
  .ticket-stub { box-shadow: none; border: 1px solid #ccc; }
}

/* ── Scroll animation ────────────────────────────────────────── */
.fade-in { opacity: 0; transform: translateY(20px); animation: fadeIn 0.6s ease forwards; }
@keyframes fadeIn { to { opacity: 1; transform: translateY(0); } }
.fade-in:nth-child(1) { animation-delay: 0.1s; }
.fade-in:nth-child(2) { animation-delay: 0.2s; }
.fade-in:nth-child(3) { animation-delay: 0.3s; }
.fade-in:nth-child(4) { animation-delay: 0.4s; }

/* ── Pagination ─────────────────────────────────────────────── */
.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 32px; }
.pagination a, .pagination span {
  padding: 8px 14px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
  border: 2px solid var(--border); color: var(--text-mid);
  transition: var(--transition);
}
.pagination a:hover { border-color: var(--purple-primary); color: var(--purple-primary); }
.pagination .current { background: var(--purple-primary); color: white; border-color: var(--purple-primary); }

/* Admin mobile nav toggle */
.admin-mobile-nav {
  display: none; background: var(--purple-darkest);
  padding: 12px 20px;
}
.admin-mobile-nav select {
  width: 100%; background: rgba(255,255,255,0.1);
  color: white; border: 1px solid rgba(255,255,255,0.2);
  padding: 8px 12px; border-radius: 6px;
}
@media(max-width:900px) { .admin-mobile-nav { display: block; } }

/* ── Dark page overrides ────────────────────────────────────── */
body.dark-page {
  background: #0a001e;
}
body.dark-page .navbar {
  background: rgba(5, 0, 16, 0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(212,168,67,0.1);
}
body.dark-page footer {
  display: block;
  background: rgba(5, 0, 16, 0.95);
  border-top: 1px solid rgba(212,168,67,0.08);
}
body.dark-page .section {
  background: transparent;
}
.admin-sidebar {
  border-right: 1px solid rgba(212,168,67,0.08);
}

/* ── Event Page Responsive Layout ───────────────────────────── */
@media (max-width: 860px) {
  .event-layout {
    grid-template-columns: 1fr !important;
  }
  .checkout-summary {
    order: -1; /* Summary appears above ticket selector on mobile */
    position: static !important;
  }
}

@media (max-width: 640px) {
  .event-hero-grid {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
    text-align: center;
  }
  .event-hero-grid > div:first-child {
    width: 140px !important;
    height: 180px !important;
    margin: 0 auto;
  }

  .ga-grade-row-grid {
    grid-template-columns: auto 1fr !important;
    row-gap: 12px !important;
  }
  .ga-grade-row-grid .qty-stepper {
    grid-column: 1 / -1;
    justify-content: center;
  }
  .ga-grade-row-grid > div:nth-child(3) {
    grid-column: 2;
    grid-row: 1;
    text-align: right;
  }

  .seat { width: 20px !important; height: 24px !important; }
  .seat-map-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  .checkout-summary {
    padding: 16px !important;
  }
}

/* ── New Animation Classes ───────────────────────────────────── */

/* Button pulse on +/- click */
@keyframes btnPulse {
  0%   { transform: scale(1); }
  40%  { transform: scale(0.82); }
  80%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}
.btn-pulse { animation: btnPulse 0.3s ease !important; }

/* Summary total number bounce */
@keyframes totalBounce {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.25); color: var(--gold); }
  60%  { transform: scale(0.95); }
  100% { transform: scale(1); }
}
.total-bounce { animation: totalBounce 0.4s ease; }
#ga-total, #grand-total, #seats-total { display: inline-block; }

/* Summary row slide in */
@keyframes summaryRowIn {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}
.summary-row-pop { animation: summaryRowIn 0.35s ease both; }

/* Summary card highlight pulse */
@keyframes summaryHighlight {
  0%   { box-shadow: var(--shadow-md); }
  50%  { box-shadow: 0 0 0 3px rgba(212,168,67,0.35), var(--shadow-md); }
  100% { box-shadow: var(--shadow-md); }
}
.summary-highlight { animation: summaryHighlight 0.6s ease; }

/* GA row active glow */
@keyframes gaRowGlow {
  from { box-shadow: 0 0 0 0 rgba(106,13,173,0); }
  50%  { box-shadow: 0 0 0 3px rgba(106,13,173,0.25); }
  to   { box-shadow: 0 0 0 0 rgba(106,13,173,0); }
}
.ga-row-active { animation: gaRowGlow 0.5s ease; }

/* Seat select pop */
@keyframes seatSelectedPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.4); box-shadow: 0 0 12px rgba(212,168,67,0.6); }
  70%  { transform: scale(0.9); }
  100% { transform: scale(1); }
}
.seat-selected-pop { animation: seatSelectedPop 0.5s cubic-bezier(0.34,1.56,0.64,1) !important; }

/* Seat selecting shimmer */
@keyframes seatSelecting {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}
.seat-selecting { animation: seatSelecting 0.4s ease infinite !important; cursor: wait !important; }

/* Checkout button ready state */
.btn-ready {
  animation: btnReadyPulse 2s ease infinite;
}
@keyframes btnReadyPulse {
  0%, 100% { box-shadow: 0 4px 14px rgba(106,13,173,0.4); }
  50%       { box-shadow: 0 4px 28px rgba(212,168,67,0.5); }
}

/* Checkout summary sticky on desktop */
@media (min-width: 861px) {
  .checkout-summary {
    position: sticky;
    top: 90px;
  }
}

/* Scroll-in animations for event page sections */
.card { animation: cardSlideIn 0.5s ease both; }
@keyframes cardSlideIn {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Seat legend item hover */
.legend-item {
  transition: transform 0.2s ease;
}
.legend-item:hover { transform: translateX(4px); }

/* ── Role & status badges ───────────────────────────────────── */
.badge-gray    { background: #eee; color: #555; }
.badge-organiser { background: #fff8e1; color: #b8860b; border: 1px solid rgba(184,134,11,0.2); }

/* Pay-at-venue order indicator */
.payment-pending-note {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(212,168,67,0.1); border: 1px solid rgba(212,168,67,0.3);
  color: #b8860b; font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 20px;
}

/* Organiser panel responsive overrides */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 540px) {
  .stats-grid { grid-template-columns: 1fr; }
}


/* ═══════════════════════════════════════════════════════════════

/* ═══════════════════════════════════════════════════════════════
   MOBILE APP SHELL
   Clean single-pass mobile overrides. All rules live here once.
   Admin pages use admin/header.php (no .page-wrapper) so
   page-wrapper-scoped rules don't touch them.
   ═══════════════════════════════════════════════════════════════ */

/* ── CSS tokens ─────────────────────────────────────────────── */
:root {
  --app-bg:       #0a0018; /* deep dark purple */
  --mob-topbar-h: 52px;
  --mob-nav-h:    58px;
  --safe-t: env(safe-area-inset-top,    0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

/* ── Show / hide helpers ────────────────────────────────────── */
/* mobile-only: hidden by default, shown inside @media */
.mobile-only        { display: none !important; }
/* desktop-only: shown by default, hidden inside @media */
.desktop-only       { display: block; }
/* mobile-bottom-nav starts hidden; @media makes it flex */
.mobile-bottom-nav  { display: none; }
/* mobile-topbar starts hidden; @media makes it flex */
.mobile-topbar      { display: none; }

/* ── Single mobile breakpoint ───────────────────────────────── */
@media (max-width: 767px) {

  /* Reveal mobile-only elements */
  .mobile-only                    { display: block  !important; }
  .mobile-only.is-flex            { display: flex   !important; }
  .mobile-only.is-grid            { display: grid   !important; }
  /* Hide desktop-only elements */
  .desktop-only                   { display: none   !important; }

  /* Body basics — seat-map pages skip overflow-x:hidden entirely */
  html:not(.has-seat-map),
  html:not(.has-seat-map) body.user-page { overflow-x: hidden; }
  * { -webkit-tap-highlight-color: transparent; }

  /* User-facing pages: bottom nav spacing + dark bg */
  body.user-page {
    overflow-x: hidden;
    padding-bottom: calc(var(--mob-nav-h) + var(--safe-b));
  }
  /* Seat map pages: completely remove ALL overflow-x constraints from every ancestor.
     Chrome gates child scroll containers through html/body overflow, Safari does not. */
  html.has-seat-map { overflow-x: clip !important; }
  html.has-seat-map body,
  html.has-seat-map body.user-page { overflow-x: visible !important; }
  body.app-page { background: var(--app-bg) !important; }

  /* page-wrapper stretches full height */
  .page-wrapper {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
  }
  .page-wrapper main { flex: 1; }

  /* Kill desktop nav + footer on user-facing pages only */
  .page-wrapper .navbar  { display: none !important; }
  .page-wrapper footer   { display: none !important; }

  /* Hide desktop-specific browse elements */
  .browse-hero, .page-hero, .filter-bar { display: none !important; }

  /* iOS auto-zoom prevention: user pages only */
  body.user-page input,
  body.user-page select,
  body.user-page textarea { font-size: 16px; }

  /* Container gutters: user pages only */
  body.user-page .container { padding-left: 14px; padding-right: 14px; }

  /* Mobile top bar */
  .mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 110;
    width: 100%;
    box-sizing: border-box;
    height: calc(var(--mob-topbar-h) + var(--safe-t));
    padding-top: var(--safe-t);
    padding-left: 14px;
    padding-right: 14px;
    padding-bottom: 8px;
    background: rgba(8,6,15,0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(212,168,67,0.12);
  }

  /* Mobile bottom nav */
  .mobile-bottom-nav {
    display: flex !important;
    flex-direction: row;
    align-items: stretch;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 200;
    width: 100%;
    box-sizing: border-box;
    height: calc(var(--mob-nav-h) + var(--safe-b));
    padding-bottom: var(--safe-b);
    background: rgba(8,6,15,0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255,255,255,0.07);
  }

  /* Seat map smaller on mobile */
  .seat { width: 22px !important; height: 26px !important; }
  .seat-map-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ── Mobile topbar internals (always, not just in @media) ───── */
.mob-brand {
  display: flex; align-items: center; gap: 9px;
  text-decoration: none; color: #fff; min-width: 0;
}
.mob-brand-icon {
  width: 32px; height: 32px; flex-shrink: 0;
  background: linear-gradient(135deg, #7b1fa2, #d4a843);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.mob-brand-name {
  font-size: 17px; font-weight: 600;
  color: rgba(255,255,255,0.9); letter-spacing: -0.3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mob-brand-name strong { color: #d4a843; font-weight: 800; }
.mob-topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.mob-icon-btn {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.7); text-decoration: none;
  transition: background .12s;
}
.mob-icon-btn:active { background: rgba(255,255,255,0.16); }
.mob-icon-btn.is-avatar {
  background: linear-gradient(135deg, #7b1fa2, #d4a843);
  border: none; font-size: 14px; font-weight: 800; color: #fff;
}

/* ── Bottom nav tab internals ───────────────────────────────── */
.mbn-tab {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; padding: 0 2px;
  text-decoration: none;
  color: rgba(255,255,255,0.35);
  font-size: 10px; font-weight: 600;
  position: relative; overflow: hidden;
  transition: color .14s;
}
.mbn-tab svg {
  width: 22px; height: 22px; flex-shrink: 0;
  transition: transform .22s cubic-bezier(0.34,1.56,0.64,1);
}
.mbn-tab > span {
  line-height: 1; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.mbn-tab.active { color: #d4a843; }
.mbn-tab.active svg { transform: translateY(-2px) scale(1.12); }
.mbn-tab.active::after {
  content: ''; position: absolute;
  top: 0; left: 15%; right: 15%; height: 2px;
  background: #d4a843; border-radius: 0 0 3px 3px;
}
.mbn-avatar {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #7b1fa2, #d4a843);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: #fff;
  border: 2px solid transparent; transition: border-color .14s;
}
.mbn-tab.active .mbn-avatar { border-color: #d4a843; }

/* ══════════════════════════════════════════════════════════════
   BROWSE PAGE  (user/index.php + user/cinema.php)
   Dark shell, works on both mobile and desktop
   ══════════════════════════════════════════════════════════════ */
.browse-wrap {
  background: var(--app-bg);
  min-height: 100vh;
  width: 100%;
  color: #fff;
}

/* ── Search bar ─────────────────────────────────────────────── */
.mob-search {
  background: var(--app-bg);
  padding: 10px 14px 8px;
  width: 100%; box-sizing: border-box;
  position: sticky;
  top: calc(var(--mob-topbar-h) + var(--safe-t));
  z-index: 60;
}
@media (min-width: 768px) {
  .mob-search { position: static; padding: 24px 24px 12px; }
}
.mob-search-form { position: relative; }
.mob-search-input {
  display: block; width: 100%; box-sizing: border-box;
  height: 42px; border-radius: 12px;
  background: rgba(255,255,255,0.07);
  border: 1.5px solid rgba(255,255,255,0.12);
  padding: 0 14px 0 40px;
  color: #fff; font-family: inherit; font-size: 14px;
  -webkit-appearance: none; appearance: none;
  transition: border-color .18s, background .18s;
}
.mob-search-input:focus {
  outline: none; border-color: #d4a843;
  background: rgba(212,168,67,0.06);
}
.mob-search-input::placeholder { color: rgba(255,255,255,0.3); }
.mob-search-icon {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%);
  font-size: 14px; line-height: 1;
  color: rgba(255,255,255,0.3); pointer-events: none;
}

/* ── Category tabs ──────────────────────────────────────────── */
.mob-cat-bar {
  background: var(--app-bg);
  position: sticky;
  top: calc(var(--mob-topbar-h) + var(--safe-t) + 52px);
  z-index: 59;
  width: 100%; box-sizing: border-box;
}
@media (min-width: 768px) { .mob-cat-bar { position: static; } }

.mob-cat-inner {
  display: flex; flex-direction: row; gap: 7px;
  padding: 8px 14px 10px;
  overflow-x: auto; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.mob-cat-inner::-webkit-scrollbar { display: none; }
@media (min-width: 768px) {
  .mob-cat-inner { padding: 10px 24px 12px; gap: 8px; flex-wrap: wrap; overflow-x: visible; }
}

.mob-cat-pill {
  display: inline-flex; flex-direction: row;
  align-items: center; justify-content: center;
  gap: 5px; padding: 5px 10px;
  flex-shrink: 0; scroll-snap-align: start;
  border-radius: 20px;
  border: 1.5px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.55);
  text-decoration: none; white-space: nowrap;
  transition: all .14s; cursor: pointer;
  min-width: 0;
}
/* icon styled as a pill image */
.mob-cat-pill .ci {
  font-size: 15px; line-height: 1; display: inline-flex;
  align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 8px;
  background: rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.mob-cat-pill.is-active .ci { background: rgba(0,0,0,0.15); }
.mob-cat-pill .cl { font-size: 10px; font-weight: 700; letter-spacing: .2px; display: block; line-height: 1; }
.mob-cat-pill:active { opacity: .7; }
.mob-cat-pill.is-active { background: #d4a843; border-color: #d4a843; color: #0d0020; }
@media (min-width: 768px) {
  .mob-cat-pill { padding: 6px 13px; gap: 7px; }
  .mob-cat-pill .ci { font-size: 16px; width: 26px; height: 26px; }
  .mob-cat-pill .cl { font-size: 11px; }
}

/* ── Section heading ────────────────────────────────────────── */
.mob-section-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 14px 8px; width: 100%; box-sizing: border-box;
}
@media (min-width: 768px) { .mob-section-head { padding: 24px 24px 10px; } }
.mob-section-title { font-size: 18px; font-weight: 800; color: #fff; font-family: inherit; line-height: 1.2; }
.mob-section-count { font-size: 12px; color: rgba(255,255,255,0.35); white-space: nowrap; }

/* ── Event grid ─────────────────────────────────────────────── */
.ev-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px; padding: 0 14px;
  width: 100%; box-sizing: border-box;
}
@media (min-width: 520px)  { .ev-grid { grid-template-columns: repeat(3,1fr); gap: 12px; } }
@media (min-width: 768px)  { .ev-grid { padding: 0 24px; gap: 16px; } }
@media (min-width: 1024px) { .ev-grid { grid-template-columns: repeat(4,1fr); gap: 18px; } }
@media (min-width: 1280px) { .ev-grid { grid-template-columns: repeat(5,1fr); } }

/* ── Event card ─────────────────────────────────────────────── */
.ev-card-link {
  display: flex; flex-direction: column;
  border-radius: 13px; overflow: hidden;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.09);
  text-decoration: none; position: relative;
  min-width: 0; width: 100%; max-width: 100%; box-sizing: border-box;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.ev-card-link:active { transform: scale(0.96); }
@media (min-width: 768px) {
  .ev-card-link:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    border-color: rgba(212,168,67,0.25);
  }
}
.ev-card-poster {
  position: relative; width: 100%; aspect-ratio: 2 / 3;
  overflow: hidden; background: #0d0020; flex-shrink: 0;
}
.ev-card-poster img {
  display: block; width: 100%; height: 100%; object-fit: cover;
  transition: transform .3s ease;
}
.ev-card-link:hover .ev-card-poster img { transform: scale(1.05); }
.ev-card-poster-ph {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
}
.ev-card-cat {
  position: absolute; top: 6px; left: 6px;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.12); color: #d4a843;
  font-size: 8px; font-weight: 800; letter-spacing: 1px;
  text-transform: uppercase; padding: 2px 7px;
  border-radius: 20px; line-height: 1.5;
  max-width: calc(100% - 12px);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ev-card-sub {
  position: absolute; top: 6px; right: 6px;
  background: rgba(34,197,94,0.9); color: #fff;
  font-size: 7px; font-weight: 900; padding: 2px 6px;
  border-radius: 20px; letter-spacing: 1px;
  text-transform: uppercase; line-height: 1.5;
}
.ev-card-body {
  padding: 8px 10px 10px;
  display: flex; flex-direction: column;
  gap: 3px; flex: 1; min-width: 0; box-sizing: border-box;
}
.ev-card-name {
  font-size: 12px; font-weight: 700; color: #fff;
  line-height: 1.3; font-family: inherit;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.ev-card-date { font-size: 10px; color: rgba(255,255,255,0.4); line-height: 1.3; }
.ev-card-price {
  font-size: 12px; font-weight: 800; color: #d4a843;
  margin-top: auto; padding-top: 4px; white-space: nowrap;
}
.ev-card-free { color: rgba(255,255,255,0.4); font-weight: 500; }
@media (min-width: 768px) {
  .ev-card-body  { padding: 10px 12px 12px; }
  .ev-card-name  { font-size: 13px; }
  .ev-card-date  { font-size: 11px; }
  .ev-card-price { font-size: 13px; }
}

/* ── Pager ──────────────────────────────────────────────────── */
.browse-pager {
  display: flex; gap: 6px; justify-content: center;
  padding: 18px 14px; flex-wrap: wrap;
}
.browse-pager a {
  min-width: 36px; height: 36px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 8px; font-size: 13px; font-weight: 700;
  border: 1.5px solid rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.5); text-decoration: none; transition: all .14s;
}
.browse-pager a.on,
.browse-pager a:hover { background: #d4a843; color: #000; border-color: #d4a843; }

/* ── Empty state ────────────────────────────────────────────── */
.browse-empty {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 60px 24px;
  text-align: center; gap: 10px;
}
.browse-empty-icon { font-size: 52px; }
.browse-empty h3   { font-size: 18px; font-weight: 700; color: #fff; font-family: inherit; }
.browse-empty p    { font-size: 13px; color: rgba(255,255,255,0.4); line-height: 1.5; }
.browse-end-pad    { height: 16px; }

/* ══════════════════════════════════════════════════════════════
   VOUCHER REDEEM CARD
   ══════════════════════════════════════════════════════════════ */
.voucher-redeem-card {
  background: linear-gradient(135deg, #f5eeff 0%, #fffbeb 100%);
  border: 2px dashed rgba(212,168,67,0.45);
  border-radius: var(--radius-md); padding: 24px; margin-bottom: 24px;
}
.voucher-redeem-card h3 { font-size: 17px; margin-bottom: 8px; color: var(--purple-primary); }
.voucher-redeem-card p  { font-size: 13px; color: var(--text-mid); margin-bottom: 16px; }

/* ══════════════════════════════════════════════════════════════
   CHART TOGGLE BUTTONS
   ══════════════════════════════════════════════════════════════ */
.chart-btn-group { display: flex; gap: 6px; flex-wrap: wrap; }
.chart-btn {
  font-size: 11px; font-weight: 700; padding: 4px 10px;
  border-radius: 6px; border: 1px solid rgba(255,255,255,0.15);
  background: transparent; color: rgba(255,255,255,0.5);
  cursor: pointer; transition: all .15s;
}
.chart-btn.is-on  { background: #d4a843; border-color: #d4a843; color: #000; }
.chart-btn:hover:not(.is-on) { background: rgba(255,255,255,0.08); color: #fff; }

/* ══════════════════════════════════════════════════════════════
   PAGE TABS (e.g. my-tickets)
   ══════════════════════════════════════════════════════════════ */
.ptabs {
  display: flex; gap: 0; border-bottom: 2px solid var(--border);
  margin-bottom: 28px; overflow-x: auto; scrollbar-width: none;
}
.ptabs::-webkit-scrollbar { display: none; }
.ptab {
  padding: 11px 22px; font-size: 14px; font-weight: 700;
  white-space: nowrap; text-decoration: none;
  color: var(--text-mid); flex-shrink: 0;
  border-bottom: 3px solid transparent; margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.ptab:hover { color: var(--purple-primary); }
.ptab.is-active { color: var(--purple-primary); border-bottom-color: var(--purple-primary); }
.ptab-badge {
  display: inline-block; font-size: 11px; font-weight: 700;
  background: var(--purple-ghost); color: var(--purple-primary);
  padding: 2px 7px; border-radius: 10px; margin-left: 6px; vertical-align: middle;
}

/* ── Misc ───────────────────────────────────────────────────── */
.stat-sub { font-size: 11px; color: var(--text-light); margin-top: 2px; }
.trend-bar-track { height: 6px; border-radius: 3px; background: rgba(255,255,255,0.08); overflow: hidden; }
.trend-bar-fill  { height: 100%; background: linear-gradient(90deg,#d4a843,#9c27b0); }
.legend-color    { width: 16px; height: 16px; border-radius: 4px; flex-shrink: 0; display: inline-block; }

/* ══════════════════════════════════════════════════════════════
   MISSING USER-SECTION UTILITIES
   (classes used across user/ pages not defined above)
   ══════════════════════════════════════════════════════════════ */

/* ── Dark section shell (cinema/movie checkout) ─────────────── */
.section-dark {
  background: #0d0020;
  min-height: 100vh;
}

/* ── Ticket filter buttons (my-tickets.php) ─────────────────── */
.ticket-filter-btn {
  /* Extends .btn .btn-sm — no extra visual needed; JS hook only */
  transition: all 0.15s;
}

/* ── Confirmation-form rows (invitations.php) ───────────────── */
.cf-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

/* ── Register account-type tabs (register.php) ──────────────── */
.reg-tab {
  padding: 12px;
  text-align: center;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

/* ── Quantity stepper helpers (event.php, cinema-detail.php) ── */
.qty-minus,
.qty-plus {
  /* Inherits .qty-btn styles from page inline styles.
     Adding here ensures they work even when inline block is
     rendered after a CSS parse error. */
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 2px solid var(--border);
  background: var(--surface);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dark);
  transition: border-color 0.15s, color 0.15s;
  user-select: none;
  line-height: 1;
}
.qty-minus:hover,
.qty-plus:hover {
  border-color: var(--purple-primary);
  color: var(--purple-primary);
}
.qty-minus:active,
.qty-plus:active { transform: scale(0.88); }

.qty-display {
  width: 46px;
  text-align: center;
  border: 2px solid var(--border);
  border-radius: 6px;
  font-size: 16px;
  font-weight: 700;
  padding: 4px;
  background: var(--surface);
  color: var(--text-dark);
}

/* ── Date panel (cinema-detail.php / movie.php) ─────────────── */
.date-panel {
  display: none; /* Shown by JS when date selected */
}

/* ── Summary rows (checkout.php) ─────────────────────────────── */
.summary-grade-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.summary-grade-row:last-child { border-bottom: none; }

.sg-label {
  color: var(--text-mid);
}
.sg-price {
  font-weight: 700;
  color: var(--text-dark);
}

.row-total {
  font-weight: 700;
  font-size: 16px;
  color: var(--purple-primary);
}

.venue-total-display {
  font-weight: 700;
}

/* ── Summary label/price helpers (event.php order summary) ──── */
.sr-label {
  color: var(--text-mid);
  font-size: 14px;
}
.sr-price {
  font-weight: 700;
  font-size: 14px;
  color: var(--purple-primary);
}

/* ── Well tier card (event.php seating type picker) ─────────── */
.well-tier-card {
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  background: var(--white);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.well-tier-card:hover {
  border-color: var(--purple-mid);
}

/* ── Booking panel (legacy booking forms) ────────────────────── */
.booking-panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 20px;
}
.booking-panel-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-light);
  margin-bottom: 16px;
}
.booking-panel-sub {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 4px;
}
.booking-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.booking-row:last-child { border-bottom: none; }
.booking-divider {
  border: none;
  border-top: 2px solid var(--border);
  margin: 12px 0;
}
.booking-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 17px;
  font-weight: 700;
  padding-top: 12px;
  color: var(--text-dark);
}

/* ── Row label/price helpers ────────────────────────────────── */
.row-lbl { color: var(--text-mid); }

/* ── Pay-at-venue note ──────────────────────────────────────── */
.pay-venue-note {
  font-size: 11px;
  color: var(--text-light);
  text-align: center;
  margin-top: 8px;
  line-height: 1.5;
}

/* ── Invitation print card ──────────────────────────────────── */
.inv-card-print {
  max-width: 700px;
  margin: 0 auto;
  background: #fff;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

/* ════════════════════════════════════════════════════════════
   COMPREHENSIVE MOBILE RESPONSIVENESS — Admin / Organiser
   ═══════════════════════════════════════════════════════════ */

/* ── Seat map: always horizontally scrollable ─────────────── */
.seat-map-container {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  padding: 12px 0;
}
.seat-map-container::-webkit-scrollbar { height: 4px; }
.seat-map-container::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); }
.seat-map-container::-webkit-scrollbar-thumb { background: rgba(212,168,67,0.4); border-radius: 2px; }
.seat-map { min-width: max-content; }

/* ── Cinema seat scroll (movie.php) ──────────────────────── */
.seat-scroll-outer {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}
.seat-scroll-outer::-webkit-scrollbar { height: 4px; }
.seat-scroll-outer::-webkit-scrollbar-thumb { background: rgba(212,168,67,0.4); border-radius: 2px; }
#cinema-seat-grid { min-width: max-content; }

/* ── Tables: always horizontally scrollable ──────────────── */
.card table, .admin-main table {
  min-width: 480px;
}
.card > div > table,
.card .table-wrapper { 
  overflow-x: auto; 
  -webkit-overflow-scrolling: touch;
  display: block;
}

/* ── Stats grid: single column on small screens ──────────── */
@media (max-width: 600px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  .stat-card { padding: 14px 12px !important; }
  .stat-value { font-size: 18px !important; }
  .stat-label { font-size: 11px !important; }
}

@media (max-width: 380px) {
  .stats-grid { grid-template-columns: 1fr !important; }
}

/* ── Admin/Organiser main content padding ─────────────────── */
@media (max-width: 600px) {
  .admin-main { padding: 14px 12px !important; }
  .admin-page-header { 
    padding: 12px 16px 8px !important;
    flex-wrap: wrap;
    gap: 10px;
  }
  .admin-page-header h2 { font-size: 20px !important; }
}

/* ── Cards: no horizontal overflow ──────────────────────── */
.card { overflow: hidden; }
.card-body { overflow-x: auto; }
/* Seat map card must allow horizontal scroll — override every ancestor overflow:hidden */
.seat-map-card,
.seat-map-card .card-body,
.seat-map-card .card-header { overflow: visible !important; }

/* ── Form rows: stack on mobile ──────────────────────────── */
@media (max-width: 600px) {
  .form-row { 
    grid-template-columns: 1fr !important;
    gap: 0 !important;
  }
  .form-row-3 { grid-template-columns: 1fr !important; }
  form.card { padding: 16px !important; }
}

/* ── Event / cinema detail page — descriptions don't overflow */
.event-detail-desc,
.event-description,
[class*="description"],
.movie-desc {
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
  max-width: 100%;
}
p, .section p, .card p {
  overflow-wrap: break-word;
  word-break: break-word;
  max-width: 100%;
}

/* ── Event detail hero layout ────────────────────────────── */
@media (max-width: 700px) {
  .event-layout {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }
  .event-sidebar,
  .checkout-summary {
    position: static !important;
    top: auto !important;
  }
  /* Movie page layout */
  .movie-layout {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }
  .booking-panel {
    position: static !important;
  }
}

/* ── Booking panel / cinema sidebar ─────────────────────── */
@media (max-width: 860px) {
  .booking-panel { position: static !important; top: auto !important; }
}

/* ── Seat legend: wrap gracefully ─────────────────────────── */
.seat-legend { flex-wrap: wrap !important; gap: 12px !important; justify-content: center !important; }

/* ── Charts: prevent infinite resize (all pages) ─────────── */
canvas {
  max-width: 100% !important;
}
.chart-wrap,
[id$="Chart"],
[id*="chart"] {
  max-width: 100% !important;
}

/* ── Grade option selector: horizontal scroll on mobile ──── */
.grade-opts-row {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

/* ── Organiser/admin navbar on mobile ─────────────────────── */
@media (max-width: 600px) {
  .navbar-inner { padding: 0 12px; }
  .navbar-brand { font-size: 15px; }
  .navbar-brand img { height: 26px !important; width: 26px !important; }
}

/* ── Page hero — don't clip on narrow screens ─────────────── */
@media (max-width: 480px) {
  .page-hero { padding: 28px 16px 16px !important; }
  .page-hero h1 { font-size: 26px !important; }
  .page-hero p { font-size: 14px !important; }
}

/* ── Section padding on mobile ───────────────────────────── */
@media (max-width: 480px) {
  .section { padding-left: 12px !important; padding-right: 12px !important; }
  .container { padding-left: 12px !important; padding-right: 12px !important; }
}

/* ── Prevent any fixed-width item from breaking layout ─────── */
@media (max-width: 767px) {
  * { max-width: 100%; box-sizing: border-box; }
  img { max-width: 100%; height: auto; }
  pre, code { overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
  /* except: seat maps and grids that need to scroll */
  .seat-map, .seat-map *, #cinema-seat-grid, #cinema-seat-grid *,
  .booking-panel { max-width: none; }
  canvas { max-width: 100% !important; }
}

/* ══════════════════════════════════════════════════════════════
   COMPREHENSIVE MOBILE RESPONSIVENESS — v27
   Organiser / Admin panel + Cinema pages
   ══════════════════════════════════════════════════════════════ */

/* ── Organiser index dashboard: stack cards on mobile ───────── */
@media (max-width: 768px) {
  .dash-2col,
  div[style*="grid-template-columns:1fr 1fr"],
  div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* ── Admin sidebar hide + top nav on mobile ─────────────────── */
@media (max-width: 900px) {
  .admin-sidebar { display: none !important; }
  .admin-layout  { display: block !important; }
  .admin-main    { padding: 16px !important; }
}

/* ── Organiser / admin: tables scroll horizontally ──────────── */
.admin-main table,
.organiser-table {
  min-width: 500px;
}
.admin-main .table-wrap,
.admin-main > .card .card-body {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 767px) {
  .admin-main table { font-size: 12px; }
  .admin-main th, .admin-main td { padding: 8px 10px !important; }
  /* Stack stats grid as 2 per row on phone */
  .stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 420px) {
  .stats-grid { grid-template-columns: 1fr !important; }
}

/* ── Organiser events list cards ────────────────────────────── */
@media (max-width: 600px) {
  /* Event list action buttons stack */
  .event-actions,
  .event-card-actions {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 6px !important;
  }
  .event-actions .btn,
  .event-card-actions .btn {
    text-align: center !important;
    width: 100% !important;
  }
}

/* ── Cinema / movie seat map: proper horizontal scroll ──────── */
.seat-scroll-outer {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.18) transparent;
  padding-bottom: 6px;
  /* Allow the inner grid to be wider than the container */
  max-width: 100%;
  cursor: grab;
}
.seat-scroll-outer:active { cursor: grabbing; }
.seat-scroll-outer::-webkit-scrollbar { height: 4px; }
.seat-scroll-outer::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.22); border-radius: 2px; }

/* The content inside the scroller must not be width-constrained */
.seat-scroll-outer .seat-grid-wrap,
.seat-scroll-outer .cinema-screen {
  min-width: max-content !important;
  max-width: none !important;
}

/* cinema-wrap should clip, not scroll itself — child scroller handles it */
.cinema-wrap { overflow: hidden !important; }

/* ── Movie / Cinema page description + info ─────────────────── */
.movie-desc,
.movie-overview,
.event-description,
.movie-body p,
.movie-cast,
.booking-panel p {
  overflow-wrap: break-word  !important;
  word-wrap:     break-word  !important;
  word-break:    break-word  !important;
  hyphens:       auto        !important;
  max-width:     100%        !important;
  white-space:   normal      !important;
}

/* Meta pills: scroll horizontally, never wrap onto two lines */
.movie-meta-pills {
  overflow-x: auto !important;
  flex-wrap: nowrap !important;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.movie-meta-pills::-webkit-scrollbar { display: none; }
.movie-meta-pills .mpill { flex-shrink: 0; }

/* ── Movie/Cinema page body grid: single col on mobile ──────── */
@media (max-width: 860px) {
  .movie-body-grid {
    grid-template-columns: 1fr !important;
    gap: 0 !important;
  }
  .booking-panel {
    position: static !important;
    margin-top: 20px !important;
    border-radius: 16px !important;
  }
}

/* ── Movie hero: hide large poster on small screens ─────────── */
@media (max-width: 600px) {
  .movie-poster-wrap  { display: none !important; }
  .movie-hero-layout  { grid-template-columns: 1fr !important; gap: 0 !important; }
  .movie-hero-inner   { padding: 20px 0 28px !important; }
  .movie-title        { font-size: clamp(20px, 7vw, 36px) !important; overflow-wrap: break-word; }
  .movie-desc         { font-size: 13px !important; -webkit-line-clamp: 5; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
  .movie-body         { padding: 20px 0 80px !important; }
}

/* ── Showtime buttons: scroll on small screens ──────────────── */
@media (max-width: 600px) {
  .showtime-grid {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    padding: 12px !important;
  }
  .date-tabs {
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px !important;
  }
  .date-tab { flex-shrink: 0 !important; }
}

/* ── Organiser form improvements on mobile ──────────────────── */
@media (max-width: 600px) {
  /* Venue grid designer */
  .sg-grid { overflow-x: auto !important; }
  .sg-row { flex-wrap: nowrap !important; }

  /* Grade form: full-width inputs */
  .grade-row input[type="text"],
  .grade-row input[type="number"],
  .grade-row select { min-width: 0 !important; width: 100% !important; }

  /* Quick action buttons: wrap */
  .quick-actions { flex-wrap: wrap !important; }
  .quick-actions .btn { flex: 1 1 120px !important; text-align: center !important; }
}

/* ── Chart canvases: prevent freeze on all pages ────────────── */
/* Charts wrapped in explicit-height divs won't trigger resize loops */
.chart-container {
  position: relative;
  height: 260px;
  width: 100%;
  overflow: hidden;
}
@media (max-width: 600px) {
  .chart-container { height: 200px; }
}

/* ── Global overflow safety ─────────────────────────────────── */
/* Seat-map pages exempt from overflow-x:hidden so Chrome allows child scroll */
html:not(.has-seat-map) { overflow-x: hidden; }
body:not(.has-seat-map) { overflow-x: hidden; }
html.has-seat-map,
html.has-seat-map body { overflow-x: visible; }

/* ── Ticket view page: info grid on mobile ──────────────────── */
@media (max-width: 500px) {
  .ticket-info-grid {
    grid-template-columns: 1fr !important;
  }
  .ticket-stub {
    margin: 0 !important;
    border-radius: 16px !important;
  }
}