/* ================================================================
   TCG Webapp — Design-System
   Farben nach Original-Vereinslogo (Blau #0d9ad6, Gold #f8b800)
   Alle Werte laut ui-design.md
   ================================================================ */

/* ------ TOKENS -------------------------------------------------- */
:root {
  /* Primärfarben — Club-Blau (aus Logo) */
  --c-primary:      #0d9ad6;   /* Vereinsblau */
  --c-primary-l:    #2db3ea;   /* Hover/Links */
  --c-primary-xl:   #e0f4fb;   /* Aktive Nav, Highlights */
  --c-primary-dark: #0a7aaa;   /* Pressed */

  /* Akzent — Gold (Logo-Oval) */
  --c-accent:       #f8b800;
  --c-accent-l:     #fac835;
  --c-accent-dark:  #d49e00;
  --c-accent-text:  #5c3d00;   /* Text AUF Gold-Hintergrund */

  /* Hintergründe & Oberflächen */
  --c-bg:           #f4f8fc;
  --c-surface:      #ffffff;
  --c-surface-2:    #eaf3f9;

  /* Rahmen & Trennlinien */
  --c-border:       #c8dce8;
  --c-border-l:     #ddeef7;

  /* Text */
  --c-text:         #12293a;
  --c-text-2:       #2e4d61;
  --c-muted:        #6a8fa6;
  --c-invert:       #ffffff;

  /* Status */
  --c-success:      #1a7a3f;
  --c-success-bg:   #e6f4ec;
  --c-warning:      #92600a;
  --c-warning-bg:   #fef3cd;
  --c-error:        #b91c1c;
  --c-error-bg:     #fee2e2;
  --c-info:         #0d9ad6;
  --c-info-bg:      #e0f4fb;

  /* Code */
  --c-code-bg:      #0d1f2a;
  --c-code-fg:      #90d4f0;

  /* Schriften */
  --font-sans: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "Cascadia Code", "Consolas", monospace;

  /* Radii */
  --radius-sm: 3px;
  --radius:    6px;
  --radius-lg: 10px;

  /* Schatten */
  --shadow-sm: 0 1px 3px rgba(13,154,214,.08);
  --shadow:    0 2px 8px rgba(13,154,214,.12);
  --shadow-lg: 0 4px 20px rgba(13,154,214,.14);

  /* Layout */
  --sidebar-w: 240px;
  --topbar-h:  70px;   /* etwas höher für Logo */
}

/* ------ RESET & BASE -------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.6;
}
a { color: var(--c-primary); text-decoration: none; }
a:hover { color: var(--c-primary-l); text-decoration: underline; }
img { max-width: 100%; display: block; }
strong { font-weight: 600; }

/* ------ LAYOUT — APP -------------------------------------------- */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  min-height: 100vh;
}

/* Topbar — weiß, damit das blaue Logo natürlich wirkt */
.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  background: var(--c-surface);
  border-bottom: 3px solid var(--c-accent);  /* Gold-Linie als Akzent */
  box-shadow: var(--shadow-sm);
  z-index: 10;
  gap: 1rem;
}
.topbar-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}
.topbar-logo img {
  height: 52px;
  width: auto;
  display: block;
}
.topbar-divider {
  width: 1px;
  height: 36px;
  background: var(--c-border);
  margin: 0 .5rem;
  flex-shrink: 0;
}
.topbar-spacer { flex: 1; }

/* User-Bereich rechts oben */
.topbar-user {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}
.topbar-user-info {
  text-align: right;
  line-height: 1.25;
}
.topbar-user-name {
  font-size: .9rem;
  font-weight: 600;
  color: var(--c-text);
}
.topbar-user-function {
  font-size: .75rem;
  color: var(--c-muted);
}
.topbar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--c-primary);
  color: var(--c-invert);
  font-size: .85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.topbar-logout {
  display: flex;
  align-items: center;
  gap: .35rem;
  padding: .4rem .8rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-size: .82rem;
  color: var(--c-text-2);
  background: transparent;
  cursor: pointer;
  font-family: var(--font-sans);
  text-decoration: none;
  transition: border-color .12s, background .12s;
}
.topbar-logout:hover { border-color: var(--c-error); color: var(--c-error); background: var(--c-error-bg); }
.topbar-logout:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }

/* Sidebar */
.sidebar {
  background: var(--c-primary);
  overflow-y: auto;
  padding: 1rem 0;
}
.sidebar-section { margin-bottom: .5rem; }
.sidebar-label {
  font-size: .67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: rgba(255,255,255,.55);
  padding: .5rem 1.25rem .25rem;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .6rem 1.25rem;
  color: rgba(255,255,255,.85);
  font-size: .88rem;
  border-left: 3px solid transparent;
  transition: background .12s;
  text-decoration: none;
}
.sidebar-nav a:hover {
  background: rgba(255,255,255,.12);
  color: #fff;
  text-decoration: none;
}
.sidebar-nav a.active {
  background: rgba(255,255,255,.18);
  border-left-color: var(--c-accent);
  color: #fff;
  font-weight: 600;
}
.sidebar-nav a .nav-icon { width: 1.3em; text-align: center; font-size: 1rem; }
.sidebar-divider { border: none; border-top: 1px solid rgba(255,255,255,.15); margin: .5rem 1rem; }

/* Main content */
.main-content {
  overflow-y: auto;
  padding: 2rem 2.5rem;
}
.content-inner { max-width: 960px; }

/* ------ LAYOUT — LOGIN ------------------------------------------ */
.login-layout {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-dark) 100%);
}
.login-box {
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}
.login-logo img {
  max-height: 100px;
  width: auto;
  margin: 0 auto;
}
.login-title {
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  color: var(--c-text-2);
  margin-bottom: 1.75rem;
}

/* ------ PAGE HEADER --------------------------------------------- */
.page-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--c-border);
}
.page-header h1 { font-size: 1.4rem; font-weight: 700; color: var(--c-primary); }
.page-header-actions { margin-left: auto; display: flex; gap: .5rem; }
.page-back {
  color: var(--c-muted);
  font-size: .83rem;
  display: flex;
  align-items: center;
  gap: .25rem;
}
.page-back:hover { color: var(--c-primary); }

/* ------ HEADINGS ------------------------------------------------- */
h1 { font-size: 1.5rem; font-weight: 700; color: var(--c-primary); margin-bottom: .75rem; }
h2 { font-size: 1.1rem; font-weight: 600; color: var(--c-text); margin-bottom: .5rem; }
h3 { font-size: .95rem; font-weight: 600; margin-bottom: .4rem; }

/* ------ BUTTONS -------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: .88rem;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  text-decoration: none;
  line-height: 1.4;
  transition: background .12s, border-color .12s;
  white-space: nowrap;
}
.btn:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }
.btn:hover { text-decoration: none; }

.btn-primary   { background: var(--c-primary); color: var(--c-invert); border-color: var(--c-primary); }
.btn-primary:hover { background: var(--c-primary-l); border-color: var(--c-primary-l); }

.btn-accent    { background: var(--c-accent); color: var(--c-accent-text); border-color: var(--c-accent); font-weight: 700; }
.btn-accent:hover { background: var(--c-accent-l); border-color: var(--c-accent-l); }

.btn-secondary { background: var(--c-surface); color: var(--c-text); border-color: var(--c-border); }
.btn-secondary:hover { background: var(--c-surface-2); }

.btn-danger    { background: var(--c-error); color: var(--c-invert); border-color: var(--c-error); }
.btn-danger:hover { background: #991b1b; border-color: #991b1b; }

.btn-ghost     { background: transparent; color: var(--c-primary); border-color: transparent; }
.btn-ghost:hover { background: var(--c-primary-xl); }

.btn-sm { padding: .3rem .65rem; font-size: .8rem; }

/* ------ FORMS ---------------------------------------------------- */
.form-section { max-width: 640px; }
.form-group { margin-bottom: 1.1rem; }
.form-label {
  display: block;
  font-size: .83rem;
  font-weight: 600;
  color: var(--c-text-2);
  margin-bottom: .35rem;
}
.required { color: var(--c-accent-dark); margin-left: .15em; }
.form-input, .form-select, .form-textarea {
  display: block;
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-size: .9rem;
  font-family: var(--font-sans);
  background: var(--c-surface);
  color: var(--c-text);
  transition: border-color .12s;
  appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(13,154,214,.18);
}
.form-input.is-invalid, .form-select.is-invalid { border-color: var(--c-error); }
.form-textarea { min-height: 100px; resize: vertical; }
.form-error { color: var(--c-error); font-size: .78rem; margin-top: .3rem; }
.form-hint  { color: var(--c-muted); font-size: .78rem; margin-top: .3rem; }
.form-check { display: flex; align-items: center; gap: .5rem; }
.form-checkbox { width: 1rem; height: 1rem; accent-color: var(--c-primary); cursor: pointer; }
.form-actions {
  display: flex;
  gap: .75rem;
  align-items: center;
  padding-top: 1.5rem;
  margin-top: 1.5rem;
  border-top: 1px solid var(--c-border-l);
}
fieldset { border: 1px solid var(--c-border-l); border-radius: var(--radius); padding: 1.25rem 1.5rem; margin-bottom: 1.5rem; }
legend { font-size: .83rem; font-weight: 600; color: var(--c-primary); padding: 0 .5rem; }

/* ------ TABLES --------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.data-table th {
  background: var(--c-primary);
  color: var(--c-invert);
  text-align: left;
  padding: .6rem .9rem;
  font-weight: 600;
  font-size: .8rem;
  white-space: nowrap;
}
.data-table th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.data-table th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }
.data-table td {
  padding: .55rem .9rem;
  border-bottom: 1px solid var(--c-border-l);
  vertical-align: middle;
}
.data-table tr:hover td { background: var(--c-surface-2); }
.data-table .col-actions { text-align: right; white-space: nowrap; width: 1%; }
.data-table .actions { display: flex; gap: .4rem; justify-content: flex-end; }

/* ------ BADGES --------------------------------------------------- */
.badge {
  display: inline-block;
  padding: .15rem .55rem;
  border-radius: 999px;
  font-size: .73rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}
.badge-success { background: var(--c-success-bg); color: var(--c-success); }
.badge-warning { background: var(--c-warning-bg); color: var(--c-warning); }
.badge-error   { background: var(--c-error-bg);   color: var(--c-error);   }
.badge-info    { background: var(--c-info-bg);     color: var(--c-primary); }
.badge-neutral { background: var(--c-surface-2);   color: var(--c-muted);   }
.badge-gold    { background: var(--c-accent);      color: var(--c-accent-text); font-weight: 700; }

/* ------ ALERTS / FLASH ------------------------------------------ */
.alert {
  padding: .85rem 1.1rem;
  border-radius: var(--radius);
  font-size: .88rem;
  margin-bottom: 1.25rem;
  border: 1px solid transparent;
}
.alert-success { background: var(--c-success-bg); color: var(--c-success); border-color: #a7d7ba; }
.alert-error   { background: var(--c-error-bg);   color: var(--c-error);   border-color: #fca5a5; }
.alert-warning { background: var(--c-warning-bg); color: var(--c-warning); border-color: #fcd34d; }
.alert-info    { background: var(--c-info-bg);     color: var(--c-primary); border-color: #7dd3f0; }

/* ------ CARDS ---------------------------------------------------- */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--c-border-l);
}
.card-header h2 { font-size: 1rem; margin: 0; }
.card-header-actions { margin-left: auto; }
.card-body { padding: 1.25rem; }

/* ------ STAT KACHELN -------------------------------------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-sm);
}
.stat-card.stat-warning { border-color: #fcd34d; background: var(--c-warning-bg); }
.stat-card.stat-error   { border-color: #fca5a5; background: var(--c-error-bg); }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--c-primary); line-height: 1.2; }
.stat-warning .stat-value { color: var(--c-warning); }
.stat-error .stat-value   { color: var(--c-error); }
.stat-label { font-size: .78rem; color: var(--c-muted); margin-top: .25rem; }

/* ------ PAGINIERUNG --------------------------------------------- */
.pagination { display: flex; align-items: center; gap: .25rem; margin-top: 1.25rem; font-size: .85rem; }
.pagination a, .pagination span {
  padding: .35rem .65rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  color: var(--c-primary);
  text-decoration: none;
}
.pagination span.active { background: var(--c-primary); color: var(--c-invert); border-color: var(--c-primary); }
.pagination a:hover { background: var(--c-primary-xl); }
.pagination .dots { border: none; color: var(--c-muted); }

/* ------ UTILS ---------------------------------------------------- */
.text-muted { color: var(--c-muted); font-size: .83rem; }
.text-right { text-align: right; }
.mt-1 { margin-top: .25rem; }  .mt-2 { margin-top: .5rem; }
.mt-4 { margin-top: 1rem; }    .mb-4 { margin-bottom: 1rem; }

/* ------ RESPONSIVE --------------------------------------------- */
@media (max-width: 640px) {
  .app-layout { grid-template-columns: 1fr; grid-template-rows: var(--topbar-h) auto 1fr; }
  .sidebar { border-bottom: 1px solid rgba(255,255,255,.2); padding: .5rem 0; }
  .main-content { padding: 1.25rem; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .topbar-user-info { display: none; }
}
