/* === DESIGN SYSTEM V3 - KOMPAKT UND OPTIMIERT === */

/* Design Tokens */
:root {
  --emerald-50: #f0fdf4;  --emerald-100: #dcfce7;  --emerald-200: #bbf7d0;
  --emerald-300: #86efac;  --emerald-500: #10b981;  --emerald-600: #059669;
  --emerald-700: #047857;  --emerald-800: #065f46;  --emerald-900: #064e3b;
  --blue-50: #eff6ff;  --blue-100: #dbeafe;  --blue-600: #2563eb;  --blue-700: #1d4ed8;
  --amber-50: #fffbeb;  --amber-100: #fef3c7;  --amber-600: #d97706;  --amber-700: #b45309;
  --red-50: #fef2f2;  --red-100: #fee2e2;  --red-600: #dc2626;  --red-700: #b91c1c;
  --shadow-sm: 0 1px 2px 0 rgb(6 95 70 / 0.06);
  --shadow-md: 0 8px 16px -2px rgb(6 95 70 / 0.10);
  --shadow-lg: 0 16px 32px -4px rgb(6 95 70 / 0.16);
  --shadow-xl: 0 28px 50px -6px rgb(6 95 70 / 0.20);
}

/* Section Cards - Dark Theme */
.section-card { background: rgba(17,63,54,0.95); backdrop-filter: blur(10px); border-radius: 1rem; padding: 1.5rem; box-shadow: var(--shadow-md); border: 1px solid rgba(28,85,75,0.3); transition: all 0.2s ease; }
.section-card:hover { box-shadow: var(--shadow-lg); border-color: rgba(28,85,75,0.5); }
.section-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; padding-bottom: 0.75rem; border-bottom: 1px solid rgba(28,85,75,0.3); }
.section-title { font-size: 1.25rem; font-weight: 600; color: #f5f3e7; margin: 0; }

/* Buttons */
.btn-unified { display: inline-flex; align-items: center; justify-content: center; padding: 0.5rem 1rem; border-radius: 0.75rem; font-size: 0.875rem; font-weight: 600; text-decoration: none; border: none; cursor: pointer; transition: all 0.2s ease; min-height: 2.5rem; gap: 0.5rem; }
.btn-primary-unified { background: linear-gradient(135deg, var(--emerald-600), var(--emerald-700)); color: white; box-shadow: var(--shadow-sm); }
.btn-primary-unified:hover { background: linear-gradient(135deg, var(--emerald-700), var(--emerald-800)); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn-secondary-unified { background: linear-gradient(135deg, var(--blue-600), var(--blue-700)); color: white; box-shadow: var(--shadow-sm); }
.btn-secondary-unified:hover { background: linear-gradient(135deg, var(--blue-700), #1e40af); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn-outline-unified { background: transparent; color: var(--emerald-700); border: 2px solid var(--emerald-600); }
.btn-outline-unified:hover { background: var(--emerald-600); color: white; }
.btn-danger-unified { background: linear-gradient(135deg, var(--red-600), var(--red-700)); color: white; box-shadow: var(--shadow-sm); }
.btn-danger-unified:hover { background: linear-gradient(135deg, var(--red-700), #991b1b); box-shadow: var(--shadow-md); transform: translateY(-1px); }
/* Aliase zu bestehenden Klassen für Konsistenz */
/* Standardisierte Button-Klassen ohne Tailwind-Direktiven */
.btn-primary, .btn-secondary, .btn-danger, .btn-warning {
  display: inline-flex; align-items: center; justify-content: center; padding: 0.5rem 1rem; border-radius: 0.75rem; font-size: 0.875rem; font-weight: 600; text-decoration: none; border: none; cursor: pointer; transition: all 0.2s ease; min-height: 2.5rem; gap: 0.5rem;
}
.btn-block { width: 100%; }

/* Farbvarianten */
.btn-primary { background: linear-gradient(135deg, var(--emerald-600), var(--emerald-700)); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: linear-gradient(135deg, var(--emerald-700), var(--emerald-800)); box-shadow: var(--shadow-md); transform: translateY(-1px); }

.btn-secondary { background: linear-gradient(135deg, var(--blue-600), var(--blue-700)); color: #fff; box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: linear-gradient(135deg, var(--blue-700), #1e40af); box-shadow: var(--shadow-md); transform: translateY(-1px); }

.btn-danger { background: linear-gradient(135deg, var(--red-600), var(--red-700)); color: #fff; box-shadow: var(--shadow-sm); }
.btn-danger:hover { background: linear-gradient(135deg, var(--red-700), #991b1b); box-shadow: var(--shadow-md); transform: translateY(-1px); }

.btn-warning { background: linear-gradient(135deg, #ea580c, #c2410c); color: #fff; box-shadow: var(--shadow-sm); }
.btn-warning:hover { background: linear-gradient(135deg, #c2410c, #9a3412); box-shadow: var(--shadow-md); transform: translateY(-1px); }

/* Statistik Cards */
.stat-card { background: linear-gradient(135deg, var(--emerald-50), rgba(255,255,255,0.8)); border-radius: 0.75rem; padding: 1rem; text-align: center; border: 1px solid var(--emerald-200); transition: all 0.2s ease; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-number { font-size: 1.5rem; font-weight: 700; color: var(--emerald-700); line-height: 1; }
.stat-label { font-size: 0.875rem; color: var(--emerald-600); margin-top: 0.25rem; font-weight: 500; }
.stat-card-success { background: linear-gradient(135deg, #f0fdf4, rgba(34,197,94,0.1)); border-color: #bbf7d0; } .stat-card-success .stat-number { color: #15803d; } .stat-card-success .stat-label { color: #166534; }
.stat-card-warning { background: linear-gradient(135deg, #fffbeb, rgba(245,158,11,0.1)); border-color: #fef3c7; } .stat-card-warning .stat-number { color: #d97706; } .stat-card-warning .stat-label { color: #92400e; }
.stat-card-danger { background: linear-gradient(135deg, #fef2f2, rgba(239,68,68,0.1)); border-color: #fee2e2; } .stat-card-danger .stat-number { color: #dc2626; } .stat-card-danger .stat-label { color: #991b1b; }
.stat-card-info { background: linear-gradient(135deg, #eff6ff, rgba(59,130,246,0.1)); border-color: #dbeafe; } .stat-card-info .stat-number { color: #2563eb; } .stat-card-info .stat-label { color: #1d4ed8; }

/* Forms - Dark Theme */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: 0.875rem; font-weight: 600; color: #f5f3e7; margin-bottom: 0.5rem; }
.form-input, .form-select { width: 100%; padding: 0.75rem; border: 2px solid rgba(28,85,75,0.5); border-radius: 0.5rem; background: rgba(18,58,51,0.9); color: #f5f3e7; font-size: 1rem; font-weight: 500; transition: all 0.2s ease; }
.form-input:focus, .form-select:focus { outline: none; border-color: #10b981; box-shadow: 0 0 0 3px rgba(16,185,129,0.2); }

/* Kompaktere Formulare nach Nutzerwunsch */
.form-compact .form-group { margin-bottom: 0.5rem; }
.form-compact .form-label { margin-bottom: 0.25rem; font-size: 0.8125rem; }
.form-compact .form-input, .form-compact .form-select, .form-compact textarea, .form-compact input, .form-compact select {
  padding: 0.5rem 0.625rem;
  border-width: 1.5px;
  font-size: 0.9375rem;
  margin-bottom: 0.5rem;
}
.form-compact .btn-unified, .form-compact button[type="submit"], .form-compact .btn-primary, .form-compact .btn-secondary {
  min-height: 2.25rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
}

/* Tabellen - Dark Theme */
.table-container { background: rgba(17,63,54,0.9); border-radius: 0.75rem; overflow: hidden; box-shadow: var(--shadow-sm); border: 1px solid rgba(28,85,75,0.3); }
.table-unified { width: 100%; border-collapse: collapse; }
.table-unified th { background: linear-gradient(135deg, rgba(20,71,62,0.8), rgba(28,85,75,0.6)); padding: 0.75rem; text-align: left; font-weight: 600; font-size: 0.875rem; color: #f5f3e7; border-bottom: 1px solid rgba(28,85,75,0.3); }
.table-unified td { padding: 0.75rem; border-bottom: 1px solid rgba(28,85,75,0.2); font-size: 0.875rem; color: #f5f3e7; }
.table-unified tr:hover { background: rgba(28,85,75,0.2); }
.table-unified tr:last-child td { border-bottom: none; }

/* Responsive Tables */
.responsive-table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 0.75rem; box-shadow: var(--shadow-sm); }
/* Kompatibilität: Seiten verwenden .responsive-table als Container */
.responsive-table { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.responsive-table table { width: 100%; border-collapse: collapse; }
.responsive-table th, .responsive-table td { word-break: break-word; overflow-wrap: anywhere; }
.responsive-table .table-mobile-cards { display: none; }
.responsive-table .table-mobile-cards .mobile-card .btn-primary,
.responsive-table .table-mobile-cards .mobile-card .btn-secondary,
.responsive-table .table-mobile-cards .mobile-card .btn-danger {
  width: auto; min-width: 8rem; align-self: flex-end;
}
@media (max-width: 768px) {
  .table-mobile-cards { display: none; }
  .table-mobile-cards.active { display: block; }
  .responsive-table table { display: none; }
  .mobile-card { background: rgba(255,255,255,0.95); border-radius: 0.75rem; padding: 1rem; margin-bottom: 0.75rem; box-shadow: var(--shadow-sm); border: 1px solid var(--emerald-200); }
  .mobile-card-header { font-weight: 600; color: var(--emerald-800); font-size: 1.125rem; margin-bottom: 0.5rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--emerald-200); }
  .mobile-card-row { display: flex; justify-content: space-between; align-items: center; padding: 0.25rem 0; font-size: 0.875rem; }
  .mobile-card-label { font-weight: 500; color: var(--emerald-700); margin-right: 0.5rem; }
  .mobile-card-value { color: var(--emerald-900); text-align: right; flex: 1; word-break: break-word; overflow-wrap: anywhere; }
  .mobile-card .btn-unified { margin-top: 0.5rem; width: 100%; min-height: 48px; }
}

/* Status Badges */
.badge { display: inline-flex; align-items: center; padding: 0.25rem 0.75rem; border-radius: 1rem; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.025em; }
.badge-success { background: var(--emerald-100); color: var(--emerald-800); border: 1px solid var(--emerald-200); }
.badge-warning { background: var(--amber-100); color: var(--amber-800); border: 1px solid #fde68a; }
.badge-danger { background: var(--red-100); color: var(--red-800); border: 1px solid #fecaca; }
.badge-info { background: var(--blue-100); color: var(--blue-800); border: 1px solid #bfdbfe; }
.badge-neutral { background: #f3f4f6; color: #374151; border: 1px solid #d1d5db; }

/* Grid System */
.grid-unified { display: grid; gap: 1rem; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); } .grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (min-width: 768px) { .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .lg\:grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

/* Pagination */
.pagination-container { margin-top: 1rem; padding: 1rem; background: rgba(255,255,255,0.9); border-radius: 0.75rem; border: 1px solid var(--emerald-200); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.pagination-info { color: var(--emerald-700); font-size: 0.875rem; font-weight: 500; }
.pagination-controls { display: flex; align-items: center; gap: 0.5rem; }
.pagination-numbers { display: flex; gap: 0.25rem; }
.pagination-number { padding: 0.5rem 0.75rem; border: 1px solid var(--emerald-300); background: white; color: var(--emerald-700); border-radius: 0.375rem; cursor: pointer; font-size: 0.875rem; font-weight: 500; transition: all 0.2s ease; min-width: 2.5rem; text-align: center; }
.pagination-number:hover { background: var(--emerald-50); border-color: var(--emerald-400); }
.pagination-number.active { background: var(--emerald-600); color: white; border-color: var(--emerald-600); }

/* Form Validation */
.field-error { border-color: #dc2626 !important; box-shadow: 0 0 0 3px rgba(220,38,38,0.1) !important; }
.field-success { border-color: #059669 !important; box-shadow: 0 0 0 3px rgba(5,150,105,0.1) !important; }
.field-error-message { color: #dc2626; font-size: 0.75rem; margin-top: 0.25rem; font-weight: 500; display: flex; align-items: center; gap: 0.25rem; }
.field-error-message::before { content: "⚠️"; font-size: 0.875rem; }
.character-counter { font-size: 0.75rem; color: var(--emerald-600); text-align: right; margin-top: 0.25rem; }
.character-counter.warning { color: #d97706; font-weight: 600; }
.loading-spinner-small { display: inline-block; width: 1rem; height: 1rem; border: 2px solid rgba(255,255,255,0.3); border-top: 2px solid white; border-radius: 50%; animation: spin 1s linear infinite; vertical-align: middle; margin-right: 0.5rem; }

/* Loading States */
.loading-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 9999; backdrop-filter: blur(4px); }
.loading-spinner { width: 3rem; height: 3rem; border: 4px solid var(--emerald-200); border-top: 4px solid var(--emerald-600); border-radius: 50%; animation: spin 1s linear infinite; }
.loading-text { margin-top: 1rem; color: white; font-weight: 600; font-size: 1.125rem; text-align: center; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.section-loading { position: relative; min-height: 200px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.8); border-radius: 0.75rem; }
.section-loading .loading-spinner { width: 2rem; height: 2rem; border-width: 3px; }
.section-loading .loading-text { color: var(--emerald-700); font-size: 1rem; margin-top: 0.5rem; }

/* Mobile Optimierungen */
@media (max-width: 768px) {
  .section-card { padding: 1rem; border-radius: 0.75rem; } .section-title { font-size: 1.125rem; }
  .btn-unified { padding: 0.75rem 1rem; font-size: 0.875rem; } .stat-card { padding: 0.75rem; }
  .stat-number { font-size: 1.25rem; } .table-unified th, .table-unified td { padding: 0.5rem; font-size: 0.8rem; }
  .pagination-container { flex-direction: column; text-align: center; }
  .pagination-controls { width: 100%; justify-content: center; }
  .pagination-numbers { flex-wrap: wrap; justify-content: center; }
}

/* Global kompakt: kleinere Abstände, Gaps, Radien */
.ui-compact .section-card { padding: 1rem; border-radius: 0.75rem; }
.ui-compact .grid-unified { gap: 0.75rem; }
.ui-compact .btn-primary, .ui-compact .btn-secondary, .ui-compact .btn-danger, .ui-compact .btn-warning { min-height: 2.25rem; padding: 0.5rem 0.75rem; font-size: 0.85rem; }
.ui-compact .form-input, .ui-compact .form-select, .ui-compact textarea, .ui-compact input, .ui-compact select { padding: 0.5rem 0.625rem; border-radius: 0.5rem; }
.ui-compact table th, .ui-compact table td { padding: 0.5rem 0.5rem; }
.ui-compact .rounded-xl { border-radius: 0.75rem; }
.ui-compact .rounded-lg { border-radius: 0.5rem; }
.ui-compact .rounded { border-radius: 0.375rem; }

/* Login-Kontrast: stellt sicher, dass eingegebener Text sichtbar bleibt */
.login-contrast input,
.login-contrast select,
.login-contrast textarea {
  color: #111 !important;
  -webkit-text-fill-color: #111 !important;
}
.login-contrast input::placeholder {
  color: #6b7280 !important;
}
.login-contrast input:-webkit-autofill,
.login-contrast input:-webkit-autofill:hover,
.login-contrast input:-webkit-autofill:focus {
  -webkit-text-fill-color: #111 !important;
  transition: background-color 9999s ease-in-out 0s;
}

/* Utility Classes */
.text-center { text-align: center; } .text-left { text-align: left; } .text-right { text-align: right; }
.mt-1 { margin-top: 0.25rem; } .mt-2 { margin-top: 0.5rem; } .mt-3 { margin-top: 0.75rem; } .mt-4 { margin-top: 1rem; } .mt-6 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.25rem; } .mb-2 { margin-bottom: 0.5rem; } .mb-3 { margin-bottom: 0.75rem; } .mb-4 { margin-bottom: 1rem; } .mb-6 { margin-bottom: 1.5rem; }
.p-2 { padding: 0.5rem; } .p-3 { padding: 0.75rem; } .p-4 { padding: 1rem; } .p-6 { padding: 1.5rem; }
.gap-2 { gap: 0.5rem; } .gap-3 { gap: 0.75rem; } .gap-4 { gap: 1rem; }
.flex { display: flex; } .flex-col { flex-direction: column; } .items-center { align-items: center; }
.justify-between { justify-content: space-between; } .justify-center { justify-content: center; }
.w-full { width: 100%; } .h-full { height: 100%; }
.rounded { border-radius: 0.25rem; } .rounded-md { border-radius: 0.375rem; } .rounded-lg { border-radius: 0.5rem; } .rounded-xl { border-radius: 0.75rem; }
.shadow-sm { box-shadow: var(--shadow-sm); } .shadow-md { box-shadow: var(--shadow-md); } .shadow-lg { box-shadow: var(--shadow-lg); }

/* Sticky Table Helper */
.table-sticky thead th { position: sticky; top: 0; z-index: 1; background: linear-gradient(135deg, var(--emerald-50), var(--emerald-100)); color: var(--emerald-800); box-shadow: inset 0 -1px 0 rgba(4,120,87,0.25); }

/* Container Helper */
.container-pro { max-width: 1200px; margin-left: auto; margin-right: auto; padding-left: 1rem; padding-right: 1rem; }

/* Elevation Utilities */
.elevate-sm { box-shadow: var(--shadow-sm); }
.elevate-md { box-shadow: var(--shadow-md); }
.elevate-lg { box-shadow: var(--shadow-lg); }
.elevate-xl { box-shadow: var(--shadow-xl); }

/* Hero Section */
.hero {
  background: linear-gradient(135deg, var(--emerald-50), #ffffff);
  border: 1px solid var(--emerald-200);
  border-radius: 1rem;
  padding: 1.25rem 1rem;
  box-shadow: var(--shadow-md);
}
.hero-title { font-size: 1.75rem; font-weight: 800; color: var(--emerald-800); letter-spacing: -0.01em; margin: 0; }
.hero-subtitle { color: var(--emerald-700); margin-top: 0.25rem; font-weight: 500; }

/* Avatar */
.avatar { width: 40px; height: 40px; border-radius: 999px; object-fit: cover; box-shadow: var(--shadow-sm); border: 2px solid var(--emerald-100); }
.avatar-lg { width: 64px; height: 64px; }
.avatar-sm { width: 28px; height: 28px; }

/* Rollen-Badges */
.role-badge { display: inline-flex; align-items: center; gap: 6px; padding: 0.25rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.02em; }
.role-admin { background: linear-gradient(135deg, #1f2937, #111827); color: #f3f4f6; border: 1px solid #374151; }
.role-mitglied { background: linear-gradient(135deg, var(--emerald-100), var(--emerald-200)); color: var(--emerald-800); border: 1px solid var(--emerald-300); }
.role-gast { background: linear-gradient(135deg, #f3f4f6, #e5e7eb); color: #374151; border: 1px solid #d1d5db; }

/* Fokus sichtbar und zugänglich */
:focus-visible { outline: 3px solid rgba(5,150,105,0.45); outline-offset: 2px; }

/* Links */
a { color: var(--emerald-700); text-decoration: none; }
a:hover { color: var(--emerald-800); text-decoration: underline; }
.link { color: var(--emerald-700); text-decoration: underline; font-weight: 600; }
.link:hover { color: var(--emerald-800); }

/* Button-Varianten & -Größen */
.btn-ghost { background: transparent; color: var(--emerald-800); border: 2px dashed var(--emerald-300); }
.btn-ghost:hover { background: var(--emerald-50); }
.btn-sm { padding: 0.375rem 0.625rem; min-height: 2rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.75rem 1.25rem; min-height: 3rem; font-size: 1rem; }

/* Kompakte Tabellen-Variante */
.table-compact th, .table-compact td { padding: 0.5rem 0.625rem; font-size: 0.85rem; }

/* Karten-Listen (einheitliche Abstände) */
.card-list { display: grid; gap: 0.75rem; }
.card-list > * { border-radius: 0.75rem; border: 1px solid var(--emerald-200); background: rgba(255,255,255,0.9); padding: 0.75rem; box-shadow: var(--shadow-sm); }

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* Toast Styles (zusätzlich zu JS) */
.toast { border-radius: 0.75rem; padding: 0.5rem 0.75rem; color: #fff; box-shadow: var(--shadow-lg); }
.toast-success { background: #10b981; }
.toast-error { background: #ef4444; }
.toast-info { background: #111827; }

/* Empty State */
.empty { text-align: center; padding: 2rem; color: var(--emerald-700); }
.empty-icon { font-size: 2rem; }
.empty-title { font-weight: 700; margin-top: 0.5rem; color: var(--emerald-900); }
.empty-sub { font-size: 0.9rem; color: var(--emerald-700); }

/* Sticky First Column helper */
.table-sticky-first td:first-child, .table-sticky-first th:first-child { position: sticky; left: 0; background: rgba(255,255,255,0.98); }
