/* ============================================================
   Senda – Mobile-First Design System
   ============================================================ */

:root {
  --bg:          #0d0f14;
  --bg2:         #161920;
  --bg3:         #1e2230;
  --card:        #1a1d27;
  --border:      #2a2f42;
  --accent:      #6c63ff;
  --accent-glow: rgba(108, 99, 255, .25);
  --accent2:     #ff6584;
  --success:     #22c55e;
  --danger:      #ef4444;
  --warning:     #f59e0b;
  --text:        #e8eaf0;
  --text-muted:  #7b82a0;
  --radius:      12px;
  --radius-sm:   8px;
  --shadow:      0 4px 24px rgba(0,0,0,.4);
  --transition:  .2s ease;
}

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

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.6;
}

/* ── Typography ────────────────────────────────────────────── */
h1 { font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 700; }
h2 { font-size: clamp(1.2rem, 3vw, 1.5rem); font-weight: 600; }
h3 { font-size: 1.1rem; font-weight: 600; }
p  { color: var(--text-muted); }

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

/* ── Layout ────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px;
}

.page-header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.page-header .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logo {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.02em;
}

.logo span { color: var(--accent); }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card + .card { margin-top: 12px; }

/* ── Event Grid ─────────────────────────────────────────────── */
.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 24px 0;
}

.event-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.event-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}

.event-card img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
}

.event-card-body {
  padding: 16px;
}

.event-card-body h3 { color: var(--text); }
.event-card-body .date {
  font-size: .85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.event-locked-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .75rem;
  background: rgba(239,68,68,.15);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,.3);
  border-radius: 20px;
  padding: 2px 10px;
  margin-top: 8px;
}

/* ── Forms ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="time"],
input[type="email"],
input[type="number"],
input[type="url"],
input[type="search"],
textarea,
select {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem;
  padding: 10px 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

input[type="file"] {
  width: 100%;
  padding: 8px;
  background: var(--bg3);
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: #5a52d5; box-shadow: 0 4px 16px var(--accent-glow); }

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover { background: #16a34a; }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #dc2626; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg3); color: var(--text); }

.btn-sm { padding: 6px 14px; font-size: .85rem; }
.btn-full { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Search ─────────────────────────────────────────────────── */
.search-wrap {
  position: relative;
}
.search-wrap input {
  padding-left: 40px;
}
.search-wrap .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-height: 280px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* iOS Momentum-Scroll */
  overscroll-behavior: contain;      /* verhindert Seiten-Scroll beim Scrollen der Liste */
  z-index: 50;
  box-shadow: var(--shadow);
}

.search-result-item {
  padding: 12px 16px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg3); }
.search-result-item .track-title { font-weight: 600; color: var(--text); }
.search-result-item .track-artist { font-size: .85rem; color: var(--text-muted); }

/* ── Request Cards ──────────────────────────────────────────── */
.request-item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 8px;
  transition: border-color var(--transition);
  animation: slideIn .3s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.request-item.status-pending  { border-left: 3px solid var(--warning); }
.request-item.status-accepted { border-left: 3px solid var(--success); }
.request-item.status-rejected { border-left: 3px solid var(--danger); opacity: .7; }

.request-item .request-info { flex: 1; min-width: 0; }
.request-item .track-title {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.request-item .track-artist {
  font-size: .85rem;
  color: var(--text-muted);
}
.request-item .request-meta {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: 4px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.request-item .request-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
}
.badge-pending  { background: rgba(245,158,11,.15); color: var(--warning); }
.badge-accepted { background: rgba(34,197,94,.15);  color: var(--success); }
.badge-rejected { background: rgba(239,68,68,.15);  color: var(--danger); }
.badge-custom   { background: rgba(108,99,255,.15); color: var(--accent); }

/* ── Status Display (Gast) ──────────────────────────────────── */
.my-requests {
  margin-top: 24px;
}
.my-request-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn .3s ease;
}
.status-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}

/* ── Toast Notifications ────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 16px;
  left: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  color: var(--text);
  font-size: .9rem;
  box-shadow: var(--shadow);
  animation: toastIn .3s ease;
  pointer-events: all;
  max-width: 420px;
  margin: 0 auto;
  width: 100%;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--accent); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Admin Sidebar / Nav ────────────────────────────────────── */
.admin-layout {
  display: flex;
  min-height: 100dvh;
}

.admin-sidebar {
  width: 220px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 24px 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.admin-sidebar .logo {
  padding: 0 20px 20px;
  font-size: 1.3rem;
}

.sidebar-nav { flex: 1; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: var(--text-muted);
  font-size: .95rem;
  font-weight: 500;
  transition: all var(--transition);
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover { background: var(--bg3); color: var(--text); text-decoration: none; }
.sidebar-nav a.active { border-left-color: var(--accent); color: var(--text); background: var(--bg3); }

.admin-main {
  flex: 1;
  overflow-x: hidden;
  padding: 28px 24px;
}

/* ── Stats Row ──────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}
.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
}
.stat-card .stat-label {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Table ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
thead th {
  text-align: left;
  padding: 10px 14px;
  background: var(--bg3);
  color: var(--text-muted);
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg3); }

/* ── Custom Checkbox ────────────────────────────────────────── */
.check-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 12px 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition);
}
.check-wrap:hover { border-color: var(--accent); }
.check-wrap input[type="checkbox"] {
  width: 0; height: 0; opacity: 0; position: absolute;
}
.check-wrap .check-box {
  width: 20px; height: 20px; min-width: 20px;
  border: 2px solid var(--border);
  border-radius: 5px;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.check-wrap input[type="checkbox"]:checked ~ .check-box {
  background: var(--accent);
  border-color: var(--accent);
}
.check-wrap input[type="checkbox"]:checked ~ .check-box::after {
  content: '';
  display: block;
  width: 5px; height: 9px;
  border: 2px solid #fff;
  border-top: none; border-left: none;
  transform: rotate(45deg) translate(-1px, -1px);
}
.check-wrap .check-label { font-size: .9rem; color: var(--text); font-weight: 500; }

/* ── Toggle Switch ──────────────────────────────────────────── */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  cursor: pointer;
  transition: var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: var(--transition);
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 16px;
  animation: fadeIn .2s ease;
}
.modal-overlay.hidden { display: none; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  max-height: 90dvh;
  overflow-y: auto;
  padding: 24px;
  animation: slideIn .25s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-header h2 { font-size: 1.1rem; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
  padding: 2px;
}
.modal-close:hover { color: var(--text); }

/* ── Live Indicator ─────────────────────────────────────────── */
.live-dot {
  width: 8px; height: 8px;
  background: var(--success);
  border-radius: 50%;
  display: inline-block;
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .5; transform: scale(.8); }
}

/* ── Misc ───────────────────────────────────────────────────── */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: .85rem; }
.text-center { text-align: center; }
.hidden { display: none !important; }

.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

.empty-state {
  text-align: center;
  padding: 48px 16px;
}
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state h3 { color: var(--text); margin-bottom: 6px; }

/* ── Password Modal (Gast) ──────────────────────────────────── */
.pw-modal {
  text-align: center;
}
.pw-modal .event-preview-img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
}
.pw-modal h2 { margin-bottom: 4px; }
.pw-modal p { margin-bottom: 20px; }

/* ── Selected Track ─────────────────────────────────────────── */
.selected-track {
  background: var(--bg3);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  .admin-sidebar {
    position: fixed;
    left: -220px;
    top: 0; bottom: 0;
    z-index: 200;
    transition: left var(--transition);
  }
  .admin-sidebar.open { left: 0; }

  .admin-main { padding: 16px 14px; }

  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px; height: 38px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text);
  }

  .request-item .request-actions {
    flex-direction: column;
  }
}

@media (min-width: 641px) {
  .mobile-menu-btn { display: none; }
}
