/* =====================================================================
 *  friendstime · Design-System  (v1.0)
 *  Modern UI/UX · Mobile-first · Dark-Mode-fähig · vollständig responsiv
 * =====================================================================
 *  BUTTON-FARBEN (dokumentiert – siehe docs/UI-DESIGN.md):
 *    .btn-primary   -> Verlauf Indigo→Violett (#6366f1 → #8b5cf6)  | Hauptaktion
 *    .btn-success   -> Smaragd  #10b981                            | Bestätigen
 *    .btn-danger    -> Rot      #ef4444                            | Löschen/Sperren
 *    .btn-ghost     -> transparent + Border                        | Sekundär
 * =================================================================== */

:root {
  /* Markenfarben */
  --brand-500: #6366f1;   /* Indigo  – Primär */
  --brand-600: #4f46e5;
  --brand-700: #4338ca;
  --accent-500: #8b5cf6;  /* Violett – Akzent / Verlauf */
  --success-500: #10b981;
  --warning-500: #f59e0b;
  --danger-500:  #ef4444;
  --info-500:    #0ea5e9;

  /* Neutrale Töne (Light) */
  --bg:        #f6f7fb;
  --surface:   #ffffff;
  --surface-2: #f1f2f7;
  --border:    #e4e6ef;
  --text:      #1e2235;
  --text-mut:  #6b7090;

  --radius:    14px;
  --radius-sm: 10px;
  --shadow:    0 1px 3px rgba(20,23,45,.06), 0 8px 24px rgba(20,23,45,.06);
  --shadow-lg: 0 12px 40px rgba(20,23,45,.14);
  --gradient:  linear-gradient(135deg, var(--brand-500), var(--accent-500));
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0f1117;
    --surface:   #171a23;
    --surface-2: #1e2230;
    --border:    #2a2f40;
    --text:      #e8eaf2;
    --text-mut:  #9aa0bd;
    --shadow:    0 1px 3px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.4);
    --shadow-lg: 0 12px 40px rgba(0,0,0,.55);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout (Sidebar + Content) ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px; flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 22px 16px;
  display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 1.15rem; padding: 6px 8px 18px;
}
.sidebar .brand .logo {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--gradient); display: grid; place-items: center;
  color: #fff; font-weight: 800;
}
.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px; border-radius: var(--radius-sm);
  color: var(--text-mut); font-weight: 600; font-size: .94rem;
  transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--gradient); color: #fff; }
.nav-link .ico { width: 20px; text-align: center; }
.sidebar .spacer { flex: 1; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 26px; border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.topbar h1 { font-size: 1.25rem; font-weight: 700; }
.content { padding: 26px; max-width: 1200px; width: 100%; }

/* ---------- Karten / Grids ---------- */
.grid { display: grid; gap: 18px; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.stat .label { color: var(--text-mut); font-size: .82rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 2rem; font-weight: 800; margin-top: 6px; }
.stat .value.alert { color: var(--danger-500); }

.module-card { display: flex; flex-direction: column; gap: 10px; }
.module-card .ico-lg {
  width: 46px; height: 46px; border-radius: 12px; display: grid;
  place-items: center; font-size: 1.3rem; color: #fff; background: var(--gradient);
}
.module-card h3 { font-size: 1.05rem; }
.module-card p { color: var(--text-mut); font-size: .9rem; }
.badge-soon {
  align-self: flex-start; font-size: .7rem; font-weight: 700;
  background: var(--surface-2); color: var(--text-mut);
  padding: 3px 9px; border-radius: 999px; text-transform: uppercase;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-weight: 700; font-size: .92rem;
  padding: 11px 18px; border-radius: var(--radius-sm); border: 1px solid transparent;
  cursor: pointer; transition: transform .08s, box-shadow .15s, opacity .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--gradient); color: #fff; box-shadow: 0 6px 16px rgba(99,102,241,.35); }
.btn-primary:hover { box-shadow: 0 8px 22px rgba(99,102,241,.5); }
.btn-success { background: var(--success-500); color: #fff; }
.btn-danger  { background: var(--danger-500); color: #fff; }
.btn-ghost   { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-block   { width: 100%; }
.btn-sm      { padding: 7px 12px; font-size: .82rem; }

/* ---------- Formulare ---------- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; }
.input, select.input {
  width: 100%; padding: 12px 14px; font-size: .95rem; font-family: inherit;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(99,102,241,.18); }
.hint { font-size: .8rem; color: var(--text-mut); margin-top: 5px; }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--border); font-size: .9rem; }
th { font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-mut); }
tr:last-child td { border-bottom: none; }

.pill { font-size: .74rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.pill.owner  { background: rgba(139,92,246,.15);  color: var(--accent-500); }
.pill.admin  { background: rgba(99,102,241,.15);  color: var(--brand-600); }
.pill.member { background: rgba(14,165,233,.15);  color: var(--info-500); }
.pill.viewer { background: var(--surface-2);       color: var(--text-mut); }

/* ---------- Auth-Seiten ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1200px 600px at 50% -10%, rgba(139,92,246,.18), transparent), var(--bg); }
.auth-card { width: 100%; max-width: 410px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 20px; padding: 34px; box-shadow: var(--shadow-lg); }
.auth-card .brand { display: flex; align-items: center; gap: 11px; justify-content: center;
  font-weight: 800; font-size: 1.3rem; margin-bottom: 6px; }
.auth-card .brand .logo { width: 40px; height: 40px; border-radius: 11px; background: var(--gradient);
  display: grid; place-items: center; color: #fff; }
.auth-card .sub { text-align: center; color: var(--text-mut); margin-bottom: 24px; font-size: .92rem; }

.alert { padding: 12px 15px; border-radius: var(--radius-sm); font-size: .9rem; margin-bottom: 18px; }
.alert-error { background: rgba(239,68,68,.12); color: var(--danger-500); border: 1px solid rgba(239,68,68,.3); }
.alert-success { background: rgba(16,185,129,.12); color: var(--success-500); border: 1px solid rgba(16,185,129,.3); }

.flex { display: flex; align-items: center; }
.gap { gap: 12px; }
.between { justify-content: space-between; }
.mt { margin-top: 18px; }
.muted { color: var(--text-mut); }

/* ---------- Mobile-Navigation ---------- */
.menu-toggle { display: none; background: none; border: none; font-size: 1.5rem;
  color: var(--text); cursor: pointer; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1000px) { .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 820px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%);
    transition: transform .25s ease; box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: block; }
  .content { padding: 18px; }
  .topbar { padding: 14px 18px; }
  .grid.cols-4, .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 40; }
}
@media (max-width: 420px) {
  .stat .value { font-size: 1.6rem; }
  .auth-card { padding: 26px 20px; }
}
