/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:   #4f46e5;
  --primary-h: #4338ca;
  --accent:    #7c3aed;
  --danger:    #dc2626;
  --success:   #059669;
  --warning:   #d97706;
  --gray-50:   #f9fafb;
  --gray-100:  #f3f4f6;
  --gray-200:  #e5e7eb;
  --gray-400:  #9ca3af;
  --gray-600:  #4b5563;
  --gray-700:  #374151;
  --gray-900:  #111827;
  --radius:    10px;
  --shadow:    0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--gray-900);
  background: var(--gray-50);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow);
}
.header-inner {
  max-width: 1200px; margin: 0 auto;
  padding: .85rem 1.25rem;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.site-logo {
  font-size: 1.25rem; font-weight: 700; color: var(--primary);
  text-decoration: none; white-space: nowrap;
}
.site-logo:hover { text-decoration: none; }
.nav-links { display: flex; gap: .5rem; flex-wrap: wrap; margin-left: auto; align-items: center; }
.nav-links a, .nav-links span {
  font-size: .875rem; color: var(--gray-600); padding: .3rem .6rem; border-radius: 6px;
}
.nav-links a:hover { background: var(--gray-100); text-decoration: none; color: var(--primary); }
.nav-links .badge {
  background: var(--danger); color: #fff;
  font-size: .7rem; padding: .1rem .4rem; border-radius: 999px;
  margin-left: .2rem; vertical-align: middle;
}

.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1.25rem; }
.page-title { font-size: 1.6rem; font-weight: 700; margin-bottom: 1.25rem; color: var(--gray-900); }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-body { padding: 1.25rem; }
.card-footer { padding: .75rem 1.25rem; background: var(--gray-50); border-top: 1px solid var(--gray-200); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1rem; border-radius: 7px; font-size: .875rem;
  font-weight: 500; cursor: pointer; border: none; transition: background .15s, opacity .15s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; opacity: .9; }
.btn-primary  { background: var(--primary);  color: #fff; }
.btn-primary:hover  { background: var(--primary-h); opacity: 1; }
.btn-danger   { background: var(--danger);   color: #fff; }
.btn-success  { background: var(--success);  color: #fff; }
.btn-warning  { background: var(--warning);  color: #fff; }
.btn-ghost    { background: transparent; color: var(--gray-600); border: 1px solid var(--gray-200); }
.btn-ghost:hover { background: var(--gray-100); }
.btn-sm { padding: .3rem .7rem; font-size: .8rem; }
.btn-block { width: 100%; justify-content: center; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .875rem; font-weight: 500; margin-bottom: .35rem; color: var(--gray-700); }
.form-control {
  display: block; width: 100%;
  padding: .55rem .75rem; border: 1px solid var(--gray-200);
  border-radius: 7px; font-size: .9rem; color: var(--gray-900);
  background: #fff; transition: border-color .15s, box-shadow .15s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.15); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .75rem center; padding-right: 2.5rem; }
.form-hint { font-size: .78rem; color: var(--gray-400); margin-top: .25rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* ── Alerts / Flash ───────────────────────────────────────────────────────── */
.alert { padding: .85rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .9rem; }
.alert-success { background: #d1fae5; color: #065f46; border-left: 4px solid var(--success); }
.alert-danger   { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--danger); }
.alert-warning  { background: #fef3c7; color: #92400e; border-left: 4px solid var(--warning); }
.alert-info     { background: #ede9fe; color: #4c1d95; border-left: 4px solid var(--accent); }

/* ── Status badges ────────────────────────────────────────────────────────── */
.status-badge {
  display: inline-block; font-size: .75rem; font-weight: 600;
  padding: .15rem .55rem; border-radius: 999px;
}
.status-approved { background: #d1fae5; color: #065f46; }
.status-pending  { background: #fef3c7; color: #92400e; }
.status-rejected { background: #fee2e2; color: #991b1b; }

/* ── Event cards (public) ─────────────────────────────────────────────────── */
.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}
.event-card { display: flex; flex-direction: column; transition: box-shadow .2s; }
.event-card:hover { box-shadow: var(--shadow-lg); }
.event-card-img { width: 100%; height: 180px; object-fit: cover; }
.event-card-img-placeholder {
  width: 100%; height: 180px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; background: var(--gray-100); color: var(--gray-400);
}
.event-card-body { flex: 1; display: flex; flex-direction: column; gap: .4rem; padding: 1rem; }
.event-cat-tag {
  display: inline-block; font-size: .72rem; font-weight: 600;
  padding: .15rem .55rem; border-radius: 999px;
  color: #fff; margin-bottom: .2rem;
}
.event-title { font-size: 1.05rem; font-weight: 700; color: var(--gray-900); line-height: 1.3; }
.event-meta { font-size: .8rem; color: var(--gray-600); display: flex; gap: .6rem; flex-wrap: wrap; }
.event-meta span { display: flex; align-items: center; gap: .25rem; }
.event-desc { font-size: .875rem; color: var(--gray-600); flex: 1;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.event-card-footer { padding: .75rem 1rem; border-top: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.event-distance { font-size: .78rem; color: var(--gray-400); }

/* ── Filter panel ─────────────────────────────────────────────────────────── */
.filter-panel {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
.filter-panel h2 { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; color: var(--gray-700); }
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: .75rem;
  align-items: end;
}
.filter-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .5rem; }

/* ── Admin table ──────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead th { background: var(--gray-50); padding: .7rem 1rem; text-align: left; font-weight: 600; color: var(--gray-600); border-bottom: 2px solid var(--gray-200); white-space: nowrap; }
tbody td { padding: .7rem 1rem; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--gray-50); }
.actions { display: flex; gap: .35rem; flex-wrap: wrap; }

/* ── Admin sidebar layout ─────────────────────────────────────────────────── */
.admin-layout { display: grid; grid-template-columns: 220px 1fr; gap: 1.5rem; }
@media (max-width: 768px) { .admin-layout { grid-template-columns: 1fr; } }
.admin-sidebar {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1rem; height: fit-content; position: sticky; top: 70px;
}
.admin-sidebar h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-400); margin-bottom: .5rem; padding: 0 .5rem; }
.admin-sidebar a {
  display: flex; align-items: center; gap: .5rem;
  padding: .55rem .75rem; border-radius: 7px; font-size: .9rem; color: var(--gray-700);
}
.admin-sidebar a:hover { background: var(--gray-100); text-decoration: none; }
.admin-sidebar a.active { background: #ede9fe; color: var(--primary); font-weight: 600; }

/* ── Login page ───────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
}
.login-box { width: 100%; max-width: 380px; }
.login-box .site-logo { display: block; text-align: center; font-size: 1.5rem; margin-bottom: 1.5rem; }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 200; align-items: center; justify-content: center; padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 1.1rem; font-weight: 600; }
.modal-close { background: none; border: none; cursor: pointer; font-size: 1.3rem; color: var(--gray-400); line-height: 1; }
.modal-body { padding: 1.25rem; }

/* ── Map preview (Leaflet placeholder) ───────────────────────────────────── */
#map { height: 280px; border-radius: var(--radius); margin-top: .5rem; border: 1px solid var(--gray-200); }

/* ── Misc ─────────────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--gray-400); }
.empty-state .icon { font-size: 3rem; display: block; margin-bottom: .75rem; }
.text-muted { color: var(--gray-400); }
.text-sm { font-size: .875rem; }
.mt-1 { margin-top: .25rem; } .mt-2 { margin-top: .5rem; } .mt-3 { margin-top: .75rem; } .mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: .25rem; } .mb-2 { margin-bottom: .5rem; } .mb-3 { margin-bottom: .75rem; } .mb-4 { margin-bottom: 1rem; }
.flex { display: flex; } .gap-2 { gap: .5rem; } .flex-wrap { flex-wrap: wrap; } .items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.grid-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: #fff; border-radius: var(--radius); padding: 1.1rem 1.25rem; box-shadow: var(--shadow); }
.stat-card .stat-num { font-size: 1.9rem; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { font-size: .8rem; color: var(--gray-600); }

/* ── Detail overlay ───────────────────────────────────────────────────────── */
.detail-img { width: 100%; max-height: 320px; object-fit: cover; border-radius: var(--radius); margin-bottom: 1rem; }
