:root {
  --brand-primary: #2563eb;
  --brand-secondary: #1e293b;
  --color-bg: #f4f5f7;
  --color-surface: #ffffff;
  --color-border: #e5e7eb;
  --color-text: #111827;
  --color-text-muted: #6b7280;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 { color: var(--brand-secondary); line-height: 1.25; }
h1 { font-size: 1.75rem; margin: 0 0 1rem; }
h2 { font-size: 1.25rem; margin: 1.75rem 0 0.75rem; }

a { color: var(--brand-primary); }
a:hover { text-decoration: none; }

p.hint { color: var(--color-text-muted); font-size: 0.85rem; margin: 0.25rem 0 0; }

/* Header / nav */
.site-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 2rem;
  background: var(--brand-secondary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.site-header .brand { font-weight: 700; font-size: 1.1rem; }
.brand-link { color: #fff; text-decoration: none; display: flex; align-items: center; gap: 0.5rem; }
.brand-logo { height: 32px; max-width: 160px; object-fit: contain; display: block; }
.site-header nav { display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem; }
.site-header nav a, .site-header nav .link-button {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 0.925rem;
  transition: color 0.15s ease;
}
.site-header nav a:hover, .site-header nav .link-button:hover { color: #fff; }
.site-header nav .current-user { color: rgba(255, 255, 255, 0.6); font-size: 0.875rem; }
.site-header nav .btn-nav {
  background: var(--brand-primary);
  color: #fff;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
}
.site-header nav .btn-nav:hover { opacity: 0.9; }

/* Layout */
.container { max-width: 960px; margin: 2rem auto; padding: 0 1.25rem 3rem; width: 100%; flex: 1 0 auto; }

/* Footer */
.site-footer { padding: 1.25rem 2rem; text-align: center; flex-shrink: 0; }
.footer-credit { color: var(--color-text-muted); font-size: 0.8125rem; display: inline-flex; align-items: center; gap: 0.35rem; }
.footer-credit-logo { height: 18px; width: auto; }

/* Buttons */
.link-button { background: none; border: none; padding: 0; cursor: pointer; font: inherit; text-decoration: underline; color: inherit; }
.inline-form { display: inline; }

.btn {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  background: var(--brand-primary);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.05s ease;
}
.btn:hover { opacity: 0.9; }
.btn:active { transform: translateY(1px); }
.btn-secondary { background: var(--color-bg); color: var(--color-text); border: 1px solid var(--color-border); }
.btn-secondary:hover { background: #eceef1; opacity: 1; }
.btn-outline { background: transparent; color: var(--brand-primary); border: 2px solid var(--brand-primary); padding: calc(0.55rem - 1px) calc(1.1rem - 1px); }
.btn-outline:hover { background: var(--brand-primary); color: #fff; opacity: 1; }

/* Admin form pages (event create/edit etc.) */
.admin-page-header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.admin-page-header h1 { margin: 0.2rem 0 0.35rem; }
.admin-page-header .eyebrow { margin: 0; font-size: 0.85rem; }
.admin-page-header .eyebrow a { text-decoration: none; }
.admin-page-header .hint { margin: 0; }

.event-form .card h3 { font-size: 1rem; margin: 0 0 0.75rem; color: var(--brand-secondary); }
.event-form .form-subsection { padding-top: 1.25rem; margin-top: 1.25rem; border-top: 1px solid var(--color-border); }
.event-form .form-subsection:first-of-type { padding-top: 0; margin-top: 0; border-top: none; }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 1.25rem; }
.form-grid.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid > div > label:first-child { margin-top: 0; }
@media (max-width: 640px) {
  .form-grid, .form-grid.form-grid-3 { grid-template-columns: 1fr; }
}

.field-actions { display: flex; align-items: center; gap: 0.75rem; margin: 0.5rem 0 0; }
.field-actions .hint { margin: 0; }

.toggle-row {
  display: flex; align-items: flex-start; gap: 0.65rem;
  margin-top: 0.6rem; padding: 0.65rem 0.85rem;
  border: 1px solid var(--color-border); border-radius: 8px;
  font-weight: 500; font-size: 0.9rem; cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.event-form .form-subsection .toggle-row:first-of-type,
.toggle-row:first-child { margin-top: 0; }
.toggle-row:hover { border-color: var(--brand-primary); background: #fafbff; }
.toggle-row input[type=checkbox] { margin-top: 0.2rem; flex-shrink: 0; }

.form-actions {
  position: sticky; bottom: 1rem; z-index: 10;
  display: flex; justify-content: flex-end; align-items: center; gap: 0.75rem;
  margin-top: 1.5rem; padding: 1rem 1.25rem;
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

/* Tabbed admin detail pages */
.admin-tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--color-border); margin-bottom: 1.5rem; overflow-x: auto; }
.admin-tabs .tab-btn {
  background: none; border: none; padding: 0.75rem 1rem; margin-bottom: -1px;
  font: inherit; font-weight: 600; font-size: 0.875rem; color: var(--color-text-muted);
  cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap;
}
.admin-tabs .tab-btn:hover { color: var(--color-text); }
.admin-tabs .tab-btn.active { color: var(--brand-primary); border-bottom-color: var(--brand-primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem 1.5rem; margin: 0 0 1rem; padding: 0; }
.detail-grid dt { margin: 0; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-text-muted); font-weight: 600; }
.detail-grid dd { margin: 0.15rem 0 0; font-size: 0.95rem; }

.table-scroll { overflow-x: auto; }

/* Sanitized rich text from the event description's Jodit editor */
.event-description { margin: 1.25rem 0; }
.event-description img { max-width: 100%; height: auto; }
.event-description table { max-width: 100%; }
.event-description h1, .event-description h2, .event-description h3, .event-description h4 {
  color: var(--brand-secondary);
  margin: 1.25rem 0 0.5rem;
}
.event-description h1:first-child, .event-description h2:first-child,
.event-description h3:first-child, .event-description h4:first-child { margin-top: 0; }
.event-description p { margin: 0 0 1rem; }
.event-description ul, .event-description ol { margin: 0 0 1rem; padding-left: 1.5rem; }
.event-description blockquote {
  margin: 0 0 1rem; padding: 0.5rem 1rem;
  border-left: 3px solid var(--brand-primary);
  color: var(--color-text-muted);
}
.event-description pre, .event-description code {
  background: var(--color-bg);
  border-radius: 6px;
}
.event-description pre { padding: 0.75rem 1rem; overflow-x: auto; }
.event-description code { padding: 0.15rem 0.35rem; }


/* Flash messages */
.flashes { list-style: none; padding: 0; margin: 0 0 1.25rem; }
.flash { padding: 0.7rem 1rem; margin-bottom: 0.5rem; border-radius: var(--radius); font-size: 0.925rem; }
.flash-success { background: #d1fae5; color: #065f46; }
.flash-error { background: #fee2e2; color: #991b1b; }

/* Forms */
form.stacked { display: flex; flex-direction: column; }
form.stacked label { margin-top: 1rem; font-weight: 600; font-size: 0.9rem; }
form.stacked label:first-child { margin-top: 0; }
form.stacked input[type=text], form.stacked input[type=email], form.stacked input[type=password],
form.stacked input[type=number], form.stacked input[type=url], form.stacked input[type=datetime-local],
form.stacked input[type=date], form.stacked textarea, form.stacked select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  margin-top: 0.35rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font: inherit;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
form.stacked input:focus, form.stacked textarea:focus, form.stacked select:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 20%, transparent);
}
/* :not(.jodit-container button) keeps Jodit's own toolbar/dialog buttons on their default styling */
form.stacked button:not(.jodit-container button) {
  margin-top: 1.5rem;
  align-self: flex-start;
  padding: 0.65rem 1.4rem;
  border: none;
  border-radius: 999px;
  background: var(--brand-primary);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
form.stacked button:not(.jodit-container button):hover { opacity: 0.9; }

.color-field { display: flex; align-items: center; gap: 0.65rem; margin-top: 0.35rem; }
.color-field input[type=color] { width: 3rem; height: 2.25rem; padding: 0; border: 1px solid var(--color-border); border-radius: 6px; background: #fff; cursor: pointer; }
.color-value { font-family: ui-monospace, monospace; font-size: 0.85rem; color: var(--color-text-muted); }
.logo-preview { max-height: 80px; margin-top: 0.5rem; }

/* Tables */
table { width: 100%; border-collapse: collapse; margin: 1rem 0; background: var(--color-surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
table th, table td { text-align: left; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--color-border); font-size: 0.925rem; }
table th { color: var(--color-text-muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; background: #fafafa; }
table tbody tr:last-child td { border-bottom: none; }
table tbody tr:hover { background: #fafbfc; }

/* Cards */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.card h2:first-child { margin-top: 0; }
.card-header-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.card-header-row h2 { margin: 0; }

/* Headline images grid (event admin) */
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
.image-grid-item { border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; }
.image-grid-item img { display: block; width: 100%; height: 120px; object-fit: cover; }
.image-grid-item .inline-form { padding: 0.5rem; }

/* Modals */
dialog.modal { padding: 0; border: none; border-radius: var(--radius); box-shadow: var(--shadow-md); max-width: 32rem; width: calc(100vw - 2.5rem); }
dialog.modal::backdrop { background: rgba(15, 23, 42, 0.5); }
.modal-content { padding: 1.5rem; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--color-border); }
.modal-header h3 { margin: 0; }
.modal-close { background: none; border: none; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--color-text-muted); padding: 0; }
.modal-close:hover { color: var(--color-text); }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.75rem; margin-top: 1.25rem; }

/* Badges */
.badge { display: inline-block; padding: 0.2rem 0.65rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600; background: #e5e7eb; color: #374151; }
.badge-confirmed { background: #d1fae5; color: #065f46; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-waitlisted { background: #dbeafe; color: #1e40af; }
.badge-rejected, .badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-published { background: #d1fae5; color: #065f46; }
.badge-draft { background: #fef3c7; color: #92400e; }
.badge-future { background: #dbeafe; color: #1e40af; }
.badge-today { background: #fef3c7; color: #92400e; }
.badge-past { background: #e5e7eb; color: #374151; }

/* Feedback forms */
.field-group { margin-top: 1rem; }
.field-group:first-child { margin-top: 0; }
.field-group .help-text { margin: 0.15rem 0 0.35rem; font-size: 0.82rem; color: var(--color-text-muted); }
.field-group .required { color: #b91c1c; }
.radio-option, .checkbox-option { display: block; font-weight: normal; margin-top: 0.35rem; }
.field-group .statement { padding: 0.65rem 0.85rem; background: #f3f4f6; border-radius: 0.4rem; font-size: 0.9rem; }
.ticket-type-fields { margin-top: 0.75rem; padding: 0.75rem; border: 1px solid #e5e7eb; border-radius: 0.4rem; }

details.card summary { cursor: pointer; font-weight: 600; }
details.card table { margin-top: 0.75rem; }

@media (max-width: 640px) {
  .site-header { padding: 0.75rem 1.25rem; }
  .container { margin: 1.25rem auto; }
}

/* Admin dashboard shell */
.admin-body { background: var(--color-bg); }
.admin-shell { display: flex; min-height: 100vh; }

.admin-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--brand-secondary);
  color: rgba(255, 255, 255, 0.85);
  display: flex;
  flex-direction: column;
  padding: 1.1rem 0 1rem;
}
.admin-brand { padding: 0 1.25rem 1rem; margin-bottom: 0.5rem; border-bottom: 1px solid rgba(255, 255, 255, 0.12); }
.admin-brand a { display: block; color: #fff; font-weight: 700; font-size: 1.05rem; text-decoration: none; }
.admin-brand .brand-logo { height: 28px; max-width: 160px; object-fit: contain; }
.admin-brand-tag { display: block; font-size: 0.75rem; color: rgba(255, 255, 255, 0.55); margin-top: 0.15rem; }

.admin-nav { display: flex; flex-direction: column; gap: 0.1rem; padding: 0 0.65rem; flex: 1; overflow-y: auto; }
.admin-nav-heading { margin: 0.9rem 0.6rem 0.2rem; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: rgba(255, 255, 255, 0.4); }
.admin-nav a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.6rem;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  font-size: 0.9rem;
}
.admin-nav a svg { width: 18px; height: 18px; flex-shrink: 0; }
.admin-nav a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.admin-nav a.active { background: var(--brand-primary); color: #fff; }

.admin-sidebar-footer { padding: 0.75rem 1.25rem 0; border-top: 1px solid rgba(255, 255, 255, 0.12); margin-top: 0.5rem; }
.admin-sidebar-footer a { color: rgba(255, 255, 255, 0.6); font-size: 0.85rem; text-decoration: none; }
.admin-sidebar-footer a:hover { color: #fff; }

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.admin-topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 5;
}
.admin-topbar-title { flex: 1; min-width: 0; }
.admin-topbar-title h1 { margin: 0; font-size: 1.2rem; }
.admin-topbar-actions { display: flex; align-items: center; gap: 1rem; }
.admin-user-menu { display: flex; align-items: center; gap: 0.6rem; font-size: 0.85rem; color: var(--color-text-muted); }
.admin-user-menu .current-user { font-weight: 600; color: var(--color-text); }
.admin-sidebar-toggle { display: none; background: none; border: none; padding: 0.3rem; cursor: pointer; color: var(--color-text); }
.admin-sidebar-toggle svg { width: 22px; height: 22px; }

.admin-content { flex: 1; padding: 1.5rem; max-width: 1200px; width: 100%; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.stat-card .stat-value { font-size: 1.9rem; font-weight: 700; color: var(--brand-secondary); }
.stat-card .stat-label { font-size: 0.85rem; color: var(--color-text-muted); }
.stat-card-alert .stat-value { color: #b45309; }

.quick-links-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.quick-link-card {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.1rem 1.25rem;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.quick-link-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.quick-link-card h3 { margin: 0 0 0.35rem; font-size: 1rem; color: var(--brand-primary); }
.quick-link-card p { margin: 0; font-size: 0.85rem; color: var(--color-text-muted); }

@media (max-width: 900px) {
  .admin-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-md);
  }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-sidebar-toggle { display: inline-flex; }
  .admin-content { padding: 1.1rem; }
}

/* Filter bar */
.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem; margin-bottom: 1rem; }
.filter-bar label { display: block; margin-bottom: 0.35rem; font-weight: 600; font-size: 0.9rem; }
.filter-bar input, .filter-bar select {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font: inherit;
  background: #fff;
}
.filter-bar-actions { display: flex; gap: 0.5rem; }
.filter-bar-actions button { padding: 0.65rem 1.4rem; border: none; border-radius: 999px; background: var(--brand-primary); color: #fff; font-weight: 600; cursor: pointer; }

/* Pagination */
.pagination { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 1rem 0; }
.pagination a, .pagination span { padding: 0.4rem 0.7rem; border-radius: 8px; font-size: 0.9rem; text-decoration: none; color: var(--color-text); }
.pagination a { border: 1px solid var(--color-border); background: var(--color-surface); }
.pagination a:hover { background: #fafbfc; }
.pagination-disabled { color: var(--color-text-muted); }
.pagination-summary { margin-left: auto; color: var(--color-text-muted); font-size: 0.85rem; }

