/* ============================================================
   VEREINS-APP – Stylesheet
   Design: Dark Slate + Warm Amber Accent
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --bg-card-hover: #263347;
  --bg-input: #0f172a;
  --bg-modal: #1e293b;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent: #f59e0b;
  --accent-hover: #d97706;
  --accent-soft: rgba(245, 158, 11, 0.12);

  --success: #22c55e;
  --danger: #ef4444;
  --info: #3b82f6;
  --warning: #f59e0b;

  --border: #334155;
  --border-light: #1e293b;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);

  --font: 'DM Sans', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --nav-height: 64px;
  --bottom-nav-height: 72px;
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ---- Layout ---- */
#app { min-height: 100vh; min-height: 100dvh; }

.app-container {
  padding-top: var(--nav-height);
  padding-bottom: calc(var(--bottom-nav-height) + 16px);
}

.page { padding: 16px; max-width: 960px; margin: 0 auto; animation: fadeIn 0.25s ease; }

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

/* ---- Top Nav ---- */
.top-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-height);
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
}

.top-nav .logo {
  font-weight: 700; font-size: 1.2rem; color: var(--accent);
  display: flex; align-items: center; gap: 8px;
}

.top-nav .logo svg { width: 28px; height: 28px; }

.top-nav .user-info {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 6px 12px; border-radius: var(--radius); transition: background 0.2s;
}
.top-nav .user-info:hover { background: var(--bg-secondary); }

.top-nav .user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 0.85rem;
}

.top-nav .user-name { font-size: 0.85rem; color: var(--text-secondary); }
.top-nav .user-role { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* ---- Bottom Nav ---- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  height: var(--bottom-nav-height);
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 16px; cursor: pointer; transition: all 0.2s;
  color: var(--text-muted); text-decoration: none; position: relative;
  border-radius: var(--radius);
}
.nav-item:hover { color: var(--text-secondary); }
.nav-item.active { color: var(--accent); }
.nav-item.active::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 24px; height: 3px; background: var(--accent); border-radius: 0 0 3px 3px;
}
.nav-item svg { width: 22px; height: 22px; }
.nav-item span { font-size: 0.65rem; font-weight: 600; letter-spacing: 0.3px; text-transform: uppercase; }

.nav-badge {
  position: absolute; top: 2px; right: 8px;
  background: var(--danger); color: #fff; font-size: 0.6rem;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}

/* ---- Login Page ---- */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; min-height: 100dvh; padding: 24px;
  background: linear-gradient(135deg, #0f172a 0%, #1a1a2e 50%, #16213e 100%);
}

.login-card {
  width: 100%; max-width: 400px;
  background: var(--bg-card); border-radius: var(--radius-xl);
  padding: 48px 32px; box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.login-card .logo-large {
  text-align: center; margin-bottom: 32px;
}
.login-card .logo-large svg { width: 56px; height: 56px; margin-bottom: 12px; }
.login-card .logo-large h1 { font-size: 1.5rem; color: var(--accent); font-weight: 700; }
.login-card .logo-large p { color: var(--text-muted); font-size: 0.85rem; margin-top: 4px; }

/* ---- Forms ---- */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 0.78rem; color: var(--text-secondary);
  margin-bottom: 6px; font-weight: 500; letter-spacing: 0.3px;
  text-transform: uppercase;
}

.form-control {
  width: 100%; padding: 12px 14px; border-radius: var(--radius);
  background: var(--bg-input); border: 1px solid var(--border);
  color: var(--text-primary); font-family: var(--font); font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s; outline: none;
}
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-control::placeholder { color: var(--text-muted); }

select.form-control { cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 36px;
}

textarea.form-control { resize: vertical; min-height: 80px; }

.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius); border: none;
  font-family: var(--font); font-size: 0.9rem; font-weight: 600;
  cursor: pointer; transition: all 0.2s; text-decoration: none; white-space: nowrap;
}
.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--accent); color: #0f172a; }
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary { background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-card-hover); }

.btn-danger { background: rgba(239,68,68,0.15); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.25); }

.btn-success { background: rgba(34,197,94,0.15); color: var(--success); border: 1px solid rgba(34,197,94,0.3); }
.btn-success:hover { background: rgba(34,197,94,0.25); }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; }
.btn-edit { background: rgba(59,130,246,0.15); color: var(--info); border: 1px solid rgba(59,130,246,0.3); }
.btn-edit:hover { background: rgba(59,130,246,0.25); }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- Cards ---- */
.card {
  background: var(--bg-card); border-radius: var(--radius-lg);
  border: 1px solid var(--border); overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}
.card:hover { border-color: var(--accent-soft); }
.card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 1rem; font-weight: 600; }
.card-body { padding: 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--border); }

.card-clickable { cursor: pointer; }
.card-clickable:hover { transform: translateY(-2px); border-color: rgba(245,158,11,0.3); }

/* ---- Page Headers ---- */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.page-header h2 { font-size: 1.4rem; font-weight: 700; }
.page-header .subtitle { color: var(--text-muted); font-size: 0.85rem; }

/* ---- Lists ---- */
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border-light);
  transition: background 0.15s; cursor: pointer;
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--bg-card-hover); }

.list-item .item-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.list-item .item-content { flex: 1; min-width: 0; }
.list-item .item-title { font-weight: 600; font-size: 0.9rem; }
.list-item .item-subtitle { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.list-item .item-badge {
  padding: 3px 8px; border-radius: 6px; font-size: 0.7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
}

/* ---- Badges ---- */
.badge { padding: 3px 10px; border-radius: 6px; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.badge-admin { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge-moderator { background: rgba(59,130,246,0.15); color: var(--info); }
.badge-user { background: rgba(148,163,184,0.15); color: var(--text-secondary); }
.badge-success { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-warning { background: var(--accent-soft); color: var(--accent); }
.badge-danger { background: rgba(239,68,68,0.15); color: var(--danger); }

/* ---- Tabs ---- */
.tabs {
  display: flex; gap: 4px; margin-bottom: 20px;
  background: var(--bg-secondary); padding: 4px; border-radius: var(--radius);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.tab {
  padding: 8px 16px; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 0.82rem; font-weight: 500; color: var(--text-muted);
  transition: all 0.2s; white-space: nowrap; border: none; background: none;
  font-family: var(--font);
}
.tab:hover { color: var(--text-primary); }
.tab.active { background: var(--accent); color: #0f172a; font-weight: 600; }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-modal); border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg); border: 1px solid var(--border);
  animation: slideUp 0.3s ease;
}

@media (min-width: 640px) {
  .modal-overlay { align-items: center; padding: 24px; }
  .modal { border-radius: var(--radius-xl); }
}

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

.modal-header {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px; border-radius: 8px; border: none;
  background: var(--bg-input); color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s; font-size: 1.2rem;
}
.modal-close:hover { background: var(--border); color: var(--text-primary); }

.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
}

/* ---- Event / Schedule Specific ---- */
.schedule-grid { display: flex; flex-direction: column; gap: 16px; }

.station-card {
  background: var(--bg-card); border-radius: var(--radius-lg);
  border: 1px solid var(--border); overflow: hidden;
}
.station-header {
  padding: 14px 18px; background: rgba(245,158,11,0.06);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.station-header h4 { font-size: 0.95rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }

.shift-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px; border-bottom: 1px solid var(--border-light);
  font-size: 0.85rem;
}
.shift-row:last-child { border-bottom: none; }

.shift-time {
  font-family: var(--font-mono); font-size: 0.82rem; color: var(--accent);
  min-width: 110px; font-weight: 500;
}
.shift-slots {
  display: flex; gap: 4px; flex-wrap: wrap; flex: 1;
}
.shift-slot {
  padding: 4px 10px; border-radius: 6px; font-size: 0.75rem; font-weight: 500;
}
.shift-slot.filled { background: rgba(34,197,94,0.15); color: var(--success); }
.shift-slot.empty {
  background: rgba(148,163,184,0.08); color: var(--text-muted);
  border: 1px dashed var(--border); cursor: pointer;
}
.shift-slot.empty:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.shift-counter {
  font-size: 0.75rem; color: var(--text-muted); min-width: 50px; text-align: right;
}

/* ---- Chat / Messages ---- */
.chat-container { display: flex; flex-direction: column; height: calc(100vh - var(--nav-height) - var(--bottom-nav-height) - 32px); }

.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }

.chat-bubble {
  max-width: 80%; padding: 10px 14px; border-radius: 14px;
  font-size: 0.9rem; line-height: 1.45; position: relative;
}
.chat-bubble.incoming {
  align-self: flex-start; background: var(--bg-secondary); border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.chat-bubble.outgoing {
  align-self: flex-end; background: var(--accent); color: #0f172a;
  border-bottom-right-radius: 4px;
}
.chat-sender { font-size: 0.72rem; font-weight: 600; color: var(--accent); margin-bottom: 2px; }
.chat-bubble.outgoing .chat-sender { color: rgba(15,23,42,0.6); }
.chat-time { font-size: 0.65rem; color: var(--text-muted); margin-top: 4px; }
.chat-bubble.outgoing .chat-time { color: rgba(15,23,42,0.5); }

.chat-input-bar {
  display: flex; gap: 8px; padding: 12px 16px;
  background: var(--bg-secondary); border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.chat-input-bar input {
  flex: 1; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 20px; padding: 10px 16px; color: var(--text-primary);
  font-family: var(--font); font-size: 0.9rem; outline: none;
}
.chat-input-bar input:focus { border-color: var(--accent); }

/* ---- Stats Grid ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px; text-align: center;
}
.stat-value { font-size: 1.8rem; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }

/* ---- Empty State ---- */
.empty-state {
  text-align: center; padding: 48px 24px; color: var(--text-muted);
}
.empty-state svg { width: 48px; height: 48px; opacity: 0.3; margin-bottom: 12px; }
.empty-state h3 { color: var(--text-secondary); margin-bottom: 4px; }
.empty-state p { font-size: 0.85rem; }

/* ---- Alerts ---- */
.alert {
  padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px;
  font-size: 0.85rem; display: flex; align-items: center; gap: 8px;
}
.alert-success { background: rgba(34,197,94,0.1); color: var(--success); border: 1px solid rgba(34,197,94,0.2); }
.alert-error { background: rgba(239,68,68,0.1); color: var(--danger); border: 1px solid rgba(239,68,68,0.2); }
.alert-info { background: rgba(59,130,246,0.1); color: var(--info); border: 1px solid rgba(59,130,246,0.2); }

/* ---- Loading ---- */
.spinner {
  width: 24px; height: 24px; border: 3px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite; margin: 24px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(15,23,42,0.8); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
  .form-row { flex-direction: column; gap: 0; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .shift-row { flex-wrap: wrap; }
  .shift-time { min-width: auto; }
}

/* ---- Toast ---- */
.toast-container {
  position: fixed; top: calc(var(--nav-height) + 12px); right: 12px;
  z-index: 250; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 12px 18px; border-radius: var(--radius);
  font-size: 0.85rem; font-weight: 500;
  box-shadow: var(--shadow); animation: slideIn 0.3s ease;
  max-width: 340px;
}
.toast-success { background: #166534; color: #bbf7d0; }
.toast-error { background: #991b1b; color: #fecaca; }
.toast-info { background: #1e3a5f; color: #bfdbfe; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ---- Utilities ---- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-sm { font-size: 0.82rem; }
.text-xs { font-size: 0.72rem; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.gap-1 { gap: 8px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
