/* ============================================================
   TIQUI — base.css
   Clean Card UI — Modern & Fresh
   Helles Grau · Rasengrün-Akzente · Feine Border
   ============================================================ */

:root {
  --bg:            #f4f6f8;
  --bg-card:       #ffffff;
  --border:        #e4e8ed;
  --border-strong: #d0d7e0;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:  0 3px 8px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-lg:  0 6px 16px rgba(0,0,0,0.09), 0 2px 4px rgba(0,0,0,0.04);

  --accent:        #2e9e4f;
  --accent-light:  #48bb6a;
  --accent-dark:   #1f7a38;
  --accent-bg:     #eaf7ee;
  --accent-border: #b7e4c5;

  --gold:       #d4a820;
  --gold-light: #f0c842;
  --gold-dark:  #a07c0f;
  --gold-bg:    #fef9e7;

  --success:        #2e9e4f;
  --warning:        #d4a820;
  --danger:         #e53e3e;
  --danger-bg:      #fef2f2;
  --danger-border:  #fecaca;
  --info:           #3182ce;

  --text-primary:   #111827;
  --text-secondary: #4b5563;
  --text-muted:     #9ca3af;
  --text-on-accent: #ffffff;

  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', monospace;

  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  32px;
  --space-2xl: 48px;

  --radius-sm:   6px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-full: 9999px;

  --transition:      0.15s ease;
  --transition-slow: 0.3s ease;

  /* Aliases für Rückwärtskompatibilität — alte --neu-* Variablen */
  --bg-dark:       #1a1f2e;
  --neu-raised:    var(--shadow-md);
  --neu-raised-sm: var(--shadow-sm);
  --neu-inset:     inset 0 1px 3px rgba(0,0,0,0.08);
  --neu-inset-sm:  inset 0 1px 2px rgba(0,0,0,0.06);
  --shadow-light:  #ffffff;
  --shadow-dark:   var(--border-strong);
  --accent-shadow: rgba(46,158,79,0.3);
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  color-scheme: light;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  background-image: url("../icons/bg-hexagon.png");
  background-size: 400px auto;
  background-repeat: repeat;
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  line-height: 1.3;
  font-weight: 700;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }

p { color: var(--text-secondary); }

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

/* ---- Karten ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-md);
}

.card-sm {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--space-sm) var(--space-md);
}

/* Globale Regel: alle Elemente die box-shadow mit --neu-* nutzen
   bekommen automatisch weißen Hintergrund + Border */
.neu, .neu-sm,
.stat-tile, .match-card, .rank-row,
.tip-card, .special-card, .question-card,
.session-card, .session-select-card,
.result-card, .invite-card, .add-match-form,
.add-question-form, .new-session-form,
.settings-list, .profile-hero, .points-banner,
.my-rank-card, .rank-row-extended,
.podium-block, .leaderboard-cache,
.admin-tile, .user-card, .match-row,
.quick-action, .quiz-banner-wrap {
  background: var(--bg-card) !important;
  border: 1px solid var(--border);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 9px var(--space-md);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent-dark);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover  { background: var(--accent-dark); }
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-secondary);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover  { border-color: var(--text-muted); color: var(--text-primary); }
.btn-secondary:active { transform: scale(0.98); }

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--accent-bg); }

.btn-danger {
  background: var(--bg-card);
  color: var(--danger);
  border-color: var(--danger-border);
}
.btn-danger:hover { background: var(--danger-bg); }

.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

.btn-sm    { padding: 6px 12px; font-size: 0.8rem; border-radius: var(--radius-sm); }
.btn-lg    { padding: 13px var(--space-xl); font-size: 1rem; }
.btn-block { width: 100%; }

/* ---- Inputs ---- */
.input {
  width: 100%;
  padding: 10px var(--space-md);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.input::placeholder { color: var(--text-muted); }

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(46, 158, 79, 0.15);
}

.input-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.input-group { margin-bottom: var(--space-md); }

.input-score {
  width: 72px;
  height: 64px;
  text-align: center;
  font-size: 1.75rem;
  font-weight: 800;
  padding: 0;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text-primary);
  outline: none;
}

.input-score:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(46,158,79,0.15);
}

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.badge-green  { background: var(--accent-bg);  color: var(--accent-dark);    border-color: var(--accent-border); }
.badge-gold   { background: var(--gold-bg);     color: var(--gold-dark);      border-color: #f9e08b; }
.badge-gray   { background: #f3f4f6;            color: var(--text-secondary); border-color: var(--border); }
.badge-danger { background: var(--danger-bg);   color: var(--danger);         border-color: var(--danger-border); }
.badge-blue   { background: #eff6ff;            color: #1d4ed8;               border-color: #bfdbfe; }

/* ---- Divider ---- */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-lg) 0;
}

/* ---- Skeleton ---- */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}

.skel {
  background: #e9ecf0;
  border-radius: var(--radius-sm);
  animation: pulse 1.4s ease-in-out infinite;
  display: block;
}

/* ---- Toasts ---- */
.toast-container {
  position: fixed;
  bottom: 88px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
  width: calc(100% - 2 * var(--space-lg));
  max-width: 400px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-sm) var(--space-md);
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  animation: toast-in 0.25s ease;
  pointer-events: auto;
  color: var(--text-primary);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

/* ---- Modals ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: var(--space-md);
  animation: fade-in 0.2s ease;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl) var(--radius-xl) var(--radius-lg) var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-xl);
  width: 100%;
  max-width: 480px;
  animation: slide-up 0.25s ease;
}

@keyframes fade-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up {
  from { transform: translateY(32px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ---- Fortschrittsbalken ---- */
.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  color: var(--text-muted);
}

.empty-state-icon  { font-size: 2.5rem; display: block; margin-bottom: var(--space-md); opacity: 0.4; }
.empty-state-title { font-weight: 600; color: var(--text-secondary); margin-bottom: var(--space-sm); font-size: 0.95rem; }

/* ---- Loader ---- */
.loader-spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.7s linear infinite;
}

.loader-spinner-dark {
  width: 16px; height: 16px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Utility ---- */
.text-center     { text-align: center; }
.text-right      { text-align: right; }
.text-accent     { color: var(--accent); }
.text-muted      { color: var(--text-muted); }
.text-danger     { color: var(--danger); }
.text-sm         { font-size: 0.875rem; }
.text-xs         { font-size: 0.75rem; }
.text-lg         { font-size: 1.125rem; }
.font-bold       { font-weight: 700; }
.font-semibold   { font-weight: 600; }
.flex            { display: flex; }
.flex-col        { flex-direction: column; }
.items-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-sm          { gap: var(--space-sm); }
.gap-md          { gap: var(--space-md); }
.gap-lg          { gap: var(--space-lg); }
.mt-sm           { margin-top: var(--space-sm); }
.mt-md           { margin-top: var(--space-md); }
.mt-lg           { margin-top: var(--space-lg); }
.mb-sm           { margin-bottom: var(--space-sm); }
.mb-md           { margin-bottom: var(--space-md); }
.mb-lg           { margin-bottom: var(--space-lg); }
.w-full          { width: 100%; }
.hidden          { display: none !important; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar        { width: 4px; height: 4px; }
::-webkit-scrollbar-track  { background: transparent; }
::-webkit-scrollbar-thumb  { background: var(--border-strong); border-radius: var(--radius-full); }

/* ---- Focus ---- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
