/* ==========================================================================
   Holzfreunde Brennholz-Punkte & Holzverteilung - Design System
   ========================================================================== */

:root {
  /* Color Palette - Forest & Warm Timber Oak */
  --bg-primary: #09120e;
  --bg-surface: #101e18;
  --bg-card: #122119;
  --bg-card-hover: #192d23;
  --bg-glass: rgba(16, 30, 24, 0.92);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-amber: rgba(245, 158, 11, 0.35);
  --border-emerald: rgba(16, 185, 129, 0.35);

  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --amber-400: #fbbf24;
  --amber-glow: rgba(245, 158, 11, 0.25);

  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-400: #34d399;

  --wood-accent: #874922;
  --forest-green: #14532d;

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

  --success: #10b981;
  --danger: #ef4444;

  /* Typography */
  --font-heading: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;

  /* Radii & Shadows */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 25px rgba(245, 158, 11, 0.25);

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-image:
    radial-gradient(circle at 10% 20%, rgba(16, 185, 129, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 90% 80%, rgba(245, 158, 11, 0.08) 0%, transparent 45%);
  pointer-events: none;
  z-index: -1;
  will-change: transform;
}

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

.app-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem 1rem;
  width: 100%;
  flex: 1;
}

/* Header */
.app-header {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1.25rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0.75rem;
  z-index: 100;
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand-logo {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #15803d 0%, #ea580c 100%);
  border: 1px solid rgba(251, 146, 60, 0.4);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px rgba(234, 88, 12, 0.25);
  color: #ffffff;
  flex-shrink: 0;
  padding: 2px;
}

.icon-svg-brand {
  width: 30px;
  height: 30px;
  display: block;
}

.brand-text-block {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 40%, #fb923c 85%, #fbbf24 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
  line-height: 1.15;
}

.brand-subtitle {
  font-size: 0.72rem;
  color: var(--amber-400);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.subtitle-short {
  display: none;
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  padding: 0.4rem 0.8rem 0.4rem 0.4rem;
  border-radius: var(--radius-full);
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--amber-500);
}

.user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.user-role-tag {
  font-size: 0.68rem;
  color: var(--amber-400);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--amber-500), var(--amber-600));
  color: #09120e;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--amber-400), var(--amber-500));
  transform: translateY(-1px);
}

.btn-emerald {
  background: linear-gradient(135deg, var(--emerald-500), var(--emerald-600));
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.btn-emerald:hover {
  background: linear-gradient(135deg, var(--emerald-400), var(--emerald-500));
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

/* Tabs */
.nav-tabs {
  display: flex;
  gap: 0.5rem;
  background: var(--bg-surface);
  padding: 0.4rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  margin-bottom: 1.5rem;
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 0.85rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.tab-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.tab-text-short {
  display: none;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(16, 185, 129, 0.18));
  color: var(--amber-400);
  border: 1px solid var(--border-amber);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Mobile Tab Optimization */
@media (max-width: 768px) {
  .nav-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.3rem;
    padding: 0.3rem;
  }

  .tab-btn {
    padding: 0.5rem 0.2rem;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
    text-align: center;
    border-radius: var(--radius-sm);
  }

  .tab-icon {
    font-size: 1.25rem;
  }

  .tab-text-full {
    display: none;
  }

  .tab-text-short {
    display: block;
    font-size: 0.75rem;
    line-height: 1.1;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* Access Banner */
.access-banner {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid var(--border-emerald);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.access-banner.read-only {
  background: rgba(245, 158, 11, 0.08);
  border-color: var(--border-amber);
}

.access-banner.warning-unauthorized {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.5);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.12);
}

/* Cards & Layout */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
  contain: content;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.card-title {
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Badges for Points */
.badge-points {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-family: var(--font-heading);
  font-size: 0.85rem;
}

.badge-points-day {
  background: rgba(16, 185, 129, 0.18);
  color: var(--emerald-400);
  border: 1px solid var(--border-emerald);
}

.badge-points-extra {
  background: rgba(245, 158, 11, 0.18);
  color: var(--amber-400);
  border: 1px solid var(--border-amber);
}

.badge-points-total {
  background: linear-gradient(135deg, var(--amber-500), var(--amber-600));
  color: #09120e;
  font-size: 0.95rem;
  padding: 0.35rem 0.8rem;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

/* Wood Allocator Highlight Box */
.allocator-hero {
  background: linear-gradient(135deg, rgba(20, 36, 29, 0.9), rgba(35, 25, 15, 0.9));
  border: 2px solid var(--border-amber);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-glow);
}

.allocator-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.allocator-result-box {
  background: rgba(9, 18, 14, 0.7);
  border: 1px solid var(--border-emerald);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.allocator-big-stat {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--amber-400);
  line-height: 1;
}

/* Forms */
.form-group {
  margin-bottom: 1.2rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(9, 18, 14, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--amber-500);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.checkbox-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 0.75rem;
}

.checkbox-card {
  background: rgba(9, 18, 14, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.checkbox-card:hover {
  border-color: var(--border-emerald);
  background: rgba(16, 185, 129, 0.05);
}

.checkbox-card input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--amber-500);
  cursor: pointer;
}

/* Tables */
.table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: rgba(9, 18, 14, 0.4);
}

.data-table {
  width: 100%;
  min-width: 620px;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
  font-size: 0.92rem;
}

.data-table th {
  background: rgba(8, 17, 12, 0.95);
  padding: 0.9rem 1.1rem;
  color: var(--text-secondary);
  font-weight: 700;
  font-family: var(--font-heading);
  border-bottom: 1px solid var(--border-subtle);
  white-space: normal;
  line-height: 1.35;
  vertical-align: middle;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.th-text-short {
  display: none;
}

.data-table td {
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  vertical-align: middle;
  transition: background var(--transition-fast);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.data-table tbody tr:hover {
  background: rgba(245, 158, 11, 0.06);
}

/* Mobile Table Optimization */
@media (max-width: 768px) {
  .data-table {
    min-width: 540px;
    font-size: 0.85rem;
  }

  .data-table th {
    padding: 0.7rem 0.65rem;
    font-size: 0.75rem;
    white-space: normal;
  }

  .data-table td {
    padding: 0.75rem 0.65rem;
    font-size: 0.84rem;
  }

  .th-text-full {
    display: none;
  }

  .th-text-short {
    display: inline;
    font-weight: 700;
  }
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.user-cell div {
  white-space: nowrap;
}

.user-avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--amber-500);
  flex-shrink: 0;
}

/* Footer */
.app-footer {
  margin-top: 3rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition-fast);
}

.footer-links a:hover {
  color: var(--amber-400);
  text-decoration: underline;
}

/* Modals & Toasts */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-normal);
  padding: 1rem;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  padding: 1.75rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  transform: translateY(20px) scale(0.95);
  transition: var(--transition-normal);
}

.modal-overlay.active .modal-card {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border-amber);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.badge-role {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
}

.badge-role.admin {
  background: rgba(245, 158, 11, 0.18);
  color: var(--amber-400);
  border: 1px solid var(--border-amber);
}

.badge-role.member {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.icon-svg {
  width: 1.1em;
  height: 1.1em;
  fill: currentColor;
  display: inline-block;
  vertical-align: -0.15em;
  flex-shrink: 0;
}

.icon-svg-sm {
  width: 0.9em;
  height: 0.9em;
}

.icon-svg-lg {
  width: 1.4em;
  height: 1.4em;
}

/* Mobile Layout & Usability Optimizations */
@media (max-width: 600px) {
  .app-container {
    padding: 0 0.5rem 2rem 0.5rem;
  }

  .app-header {
    padding: 0.45rem 0.75rem;
    gap: 0.4rem;
    top: 0;
    margin-bottom: 0.85rem;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    border-top: none;
    box-shadow: var(--shadow-sm);
  }

  .brand-container {
    gap: 0.5rem;
  }

  .brand-logo {
    width: 34px;
    height: 34px;
    border-radius: 8px;
  }

  .icon-svg-brand {
    width: 22px;
    height: 22px;
  }

  .brand-title {
    font-size: 0.96rem;
    line-height: 1.1;
  }

  .brand-subtitle {
    font-size: 0.58rem;
    letter-spacing: 0.02em;
    white-space: nowrap;
  }

  .user-profile-badge {
    padding: 0.2rem 0.45rem 0.2rem 0.25rem;
    gap: 0.35rem;
    max-width: 145px;
  }

  .user-avatar {
    width: 26px;
    height: 26px;
    border-width: 1.5px;
  }

  .user-info {
    min-width: 0;
    overflow: hidden;
  }

  .user-name {
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .user-role-tag {
    font-size: 0.6rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .checkbox-card-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .checkbox-card {
    padding: 0.85rem;
  }

  .allocator-hero {
    padding: 1.15rem;
  }

  .allocator-result-box {
    padding: 1rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .allocator-result-box>div:last-child {
    text-align: left !important;
  }

  .allocator-big-stat {
    font-size: 1.7rem;
  }

  .card {
    padding: 1.15rem;
    border-radius: var(--radius-md);
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
  }

  .user-cell {
    white-space: nowrap;
  }

  .modal-card {
    padding: 1.25rem;
    max-height: 90vh;
    overflow-y: auto;
  }

  .toast-container {
    right: 0.75rem;
    left: 0.75rem;
    bottom: 1rem;
  }

  .toast {
    width: 100%;
    font-size: 0.85rem;
  }
}

.text-amber {
  color: var(--amber-400);
}

.text-emerald {
  color: var(--emerald-400);
}

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