/* ── Base & Tokens ── */
:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --bg-base:      #070b14;
  --bg-card:      rgba(15, 23, 42, 0.92);
  --bg-card-alt:  rgba(31, 41, 55, 0.96);
  --bg-input:     rgba(15, 23, 42, 0.8);

  --border:       rgba(148, 163, 184, 0.12);
  --border-focus: rgba(99, 102, 241, 0.6);

  --text-primary:   #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted:     #94a3b8;
  --text-accent:    #a5b4fc;
  --text-link:      #7dd3fc;

  --accent-gradient: linear-gradient(135deg, #6366f1, #14b8a6);
  --accent-solid:    #6366f1;

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

  --shadow-card: 0 24px 60px rgba(15, 23, 42, 0.35);
  --shadow-sm:   0 4px 16px rgba(15, 23, 42, 0.25);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  color: var(--text-primary);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(circle at top left,    rgba(111,  66, 193, 0.30), transparent 30%),
    radial-gradient(circle at bottom right, rgba( 16, 185, 129, 0.18), transparent 25%),
    linear-gradient(180deg, #070b14 0%, #0f172a 100%);
  background-attachment: fixed;
  padding: 0 0 48px;
}

a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(7, 11, 20, 0.85);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.logo-dot {
  width: 8px; height: 8px;
  background: var(--accent-gradient);
  border-radius: 50%;
}

.header-actions { display: flex; gap: .75rem; align-items: center; }

/* ── Container ── */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1.1rem;
  border-radius: 999px;
  font-size: .875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform .15s, opacity .15s, background .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  border: none;
}
.btn-primary:hover { opacity: .88; }

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-outline:hover {
  border-color: rgba(148,163,184,.28);
  color: var(--text-primary);
  background: rgba(255,255,255,.04);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover { color: var(--text-primary); background: rgba(255,255,255,.05); }

.btn-danger {
  background: transparent;
  color: #fda4af;
  border-color: rgba(253,164,175,.2);
}
.btn-danger:hover { background: rgba(239,68,68,.1); }

.btn-sm { padding: .35rem .85rem; font-size: .8125rem; }

/* ── Filter Bar ── */
.filter-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.4rem;
  display: flex;
  gap: .75rem;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  backdrop-filter: blur(8px);
}

.filter-group { display: flex; flex-direction: column; gap: .3rem; }
.filter-bar label {
  font-size: .75rem;
  color: var(--text-accent);
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.filter-bar input,
.filter-bar select {
  padding: .45rem .85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .875rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-input);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  min-width: 130px;
}
.filter-bar input:focus,
.filter-bar select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99,102,241,.18);
}
.filter-bar select option { background: #0f172a; }

/* ── Stats ── */
.stats-bar {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
  align-items: center;
}
.stats-count {
  font-size: .875rem;
  color: var(--text-muted);
}
.stats-count strong { color: var(--text-secondary); }

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

.event-card {
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.event-card:hover {
  transform: translateY(-3px);
  border-color: rgba(99,102,241,.35);
  box-shadow: 0 32px 72px rgba(15,23,42,.45), 0 0 0 1px rgba(99,102,241,.15);
}

.event-card-image {
  width: 100%; height: 150px;
  object-fit: cover;
  background: rgba(15,23,42,.5);
}

.event-card-body {
  padding: 1.2rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.event-date-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-accent);
  background: rgba(99,102,241,.12);
  border: 1px solid rgba(99,102,241,.25);
  border-radius: 999px;
  padding: .2rem .7rem;
  width: fit-content;
  letter-spacing: .02em;
}

.event-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
}

.event-meta { display: flex; flex-direction: column; gap: .2rem; }
.event-meta-row {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .8125rem;
  color: var(--text-muted);
}

.city-label {
  cursor: default;
  border-bottom: 1px dashed rgba(148,163,184,.4);
  transition: border-color .15s, color .15s;
}
.city-label:hover {
  color: var(--text-primary);
  border-bottom-color: var(--text-accent);
}

.event-description {
  font-size: .875rem;
  color: var(--text-secondary);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.event-card-footer {
  padding: .75rem 1.2rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}

.source-tag {
  font-size: .72rem;
  color: var(--text-muted);
  background: rgba(148,163,184,.08);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .15rem .65rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
  min-width: 0;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.no-date-badge {
  font-size: .75rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ── Empty & Loading ── */
.state-empty, .state-loading {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}
.state-empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: .6; }
.state-empty h3 { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: .5rem; }

.spinner {
  width: 32px; height: 32px;
  border: 3px solid rgba(148,163,184,.15);
  border-top-color: var(--accent-solid);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Admin Table ── */
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  overflow-y: hidden;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(8px);
}

.table-wrap table {
  min-width: 700px;
}

table { width: 100%; border-collapse: collapse; }
th {
  background: rgba(15,23,42,.6);
  padding: .75rem 1rem;
  text-align: left;
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-accent);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  letter-spacing: .05em;
  text-transform: uppercase;
}
td {
  padding: .9rem 1rem;
  font-size: .875rem;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(148,163,184,.06);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.025); }

.status-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-right: .4rem;
}
.status-dot.active   { background: #34d399; box-shadow: 0 0 6px rgba(52,211,153,.5); }
.status-dot.inactive { background: var(--text-muted); }

/* ── Modal ── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(7,11,20,.75);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.modal-backdrop.open { opacity: 1; pointer-events: all; }

.modal {
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: 0 40px 100px rgba(7,11,20,.6);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(16px);
  transition: transform .2s;
}
.modal-backdrop.open .modal { transform: translateY(0); }

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h2 { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }
.modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 1.2rem; color: var(--text-muted); padding: .25rem;
  border-radius: 6px; transition: color .15s;
}
.modal-close:hover { color: var(--text-primary); }

.modal-body { padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
  align-items: center;
}

/* ── Form Fields ── */
.field { display: flex; flex-direction: column; gap: .35rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

label.field-label {
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-accent);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.field-hint { font-size: .75rem; color: var(--text-muted); margin-top: .1rem; }

input[type="text"],
input[type="url"],
input[type="number"],
textarea,
select.field-select {
  padding: .55rem .9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-input);
  outline: none;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select.field-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99,102,241,.18);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
textarea { resize: vertical; min-height: 70px; }
select.field-select option { background: #0f172a; }

.field-section-title {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}

/* ── Preview Box ── */
.preview-box {
  background: rgba(15,23,42,.8);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-size: .8125rem;
  max-height: 280px;
  overflow-y: auto;
}
.preview-event { padding: .5rem 0; border-bottom: 1px solid rgba(148,163,184,.08); }
.preview-event:last-child { border-bottom: none; }
.preview-event strong { display: block; color: var(--text-primary); margin-bottom: .15rem; }
.preview-event span   { color: var(--text-muted); }
.preview-error {
  color: #fda4af;
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.2);
  padding: .5rem .75rem;
  border-radius: var(--radius-sm);
  margin-bottom: .5rem;
}

/* ── Toast ── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.toast {
  padding: .75rem 1.25rem;
  border-radius: 999px;
  font-size: .875rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  animation: slide-in .2s ease;
  max-width: 320px;
}
@keyframes slide-in { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast-success { background: rgba(52,211,153,.15); color: #6ee7b7; border: 1px solid rgba(52,211,153,.3); }
.toast-error   { background: rgba(239,68,68,.15);  color: #fca5a5; border: 1px solid rgba(239,68,68,.3); }
.toast-info    { background: rgba(99,102,241,.15); color: var(--text-accent); border: 1px solid rgba(99,102,241,.3); }

/* ── Responsive ── */
@media (max-width: 640px) {
  .field-row { grid-template-columns: 1fr; }
  .events-grid { grid-template-columns: 1fr; }
  .header-inner { padding: 0 1rem; }
  .container { padding: 1rem; }
  .filter-bar { padding: .9rem 1rem; }
  td, th { padding: .65rem .75rem; }
  body { padding: 0 0 32px; }
}
