/* =============================================
   FREIZEITAKTIVITÄTEN – MODERNES DESIGN
   ============================================= */

/* CSS Variables */
:root {
  --sidebar-width: 260px;
  --sidebar-bg: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #ffffff;
  --sidebar-active-bg: #2563eb;
  --sidebar-hover-bg: #334155;
  --sidebar-header-bg: #0f172a;
  --accent: #2563eb;
  --accent-light: #dbeafe;
  --accent-dark: #1d4ed8;
  --body-bg: #f1f5f9;
  --card-bg: #ffffff;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --card-shadow-hover: 0 4px 12px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --transition: 0.25s cubic-bezier(.4,0,.2,1);
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; }

body {
  background: var(--body-bg);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--text-main);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  overscroll-behavior-y: contain;
}

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar.closed {
  transform: translateX(-100%);
}

.sidebar-header {
  background: var(--sidebar-header-bg);
  padding: 1.4rem 1.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
  min-height: 64px;
  user-select: none;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-header::before {
  content: '🏔️';
  font-size: 1.3rem;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  padding: 0.75rem;
  gap: 0.15rem;
  flex: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
  font-size: 0.925rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-link:hover {
  background: var(--sidebar-hover-bg);
  color: #e2e8f0;
}

.sidebar-link.active-sidebar-link {
  background: var(--sidebar-active-bg) !important;
  color: var(--sidebar-text-active) !important;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}

.sidebar-icon {
  font-size: 1.05rem;
  flex-shrink: 0;
  width: 1.4em;
  text-align: center;
}

.sidebar-arrow {
  margin-left: auto;
  font-size: 0.75rem;
  opacity: 0.6;
  transition: transform var(--transition);
  flex-shrink: 0;
}

.sidebar-accordion { width: 100%; }

.sidebar-accordion-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  background: none;
  border: none;
  outline: none;
  text-align: left;
  padding: 0.7rem 1rem;
  font-size: 0.925rem;
  font-weight: 500;
  color: var(--sidebar-text);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}

.sidebar-accordion-btn:hover,
.sidebar-accordion-btn.active {
  background: var(--sidebar-hover-bg);
  color: #e2e8f0;
}

.sidebar-accordion-btn.active .sidebar-arrow {
  transform: rotate(180deg);
  opacity: 1;
}

.sidebar-accordion-panel {
  display: none;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.2rem 0 0.2rem 2rem;
}

.sidebar-accordion-panel.open {
  display: flex;
}

.sidebar-accordion-panel .sidebar-link {
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  color: #64748b;
}

.sidebar-accordion-panel .sidebar-link:hover {
  color: #e2e8f0;
  background: rgba(255,255,255,0.05);
}

.sidebar-accordion-panel .sidebar-link.active-sidebar-link {
  background: rgba(37,99,235,0.7) !important;
  color: #fff !important;
}

/* ===== SIDEBAR TOGGLE BUTTON ===== */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 0.85rem;
  left: 0.85rem;
  z-index: 1101;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 42px;
  height: 42px;
  font-size: 1.3rem;
  box-shadow: var(--card-shadow);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition);
  line-height: 1;
}

.sidebar-toggle:hover {
  background: var(--accent-light);
}

/* ===== SIDEBAR OVERLAY ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.5);
  z-index: 999;
  backdrop-filter: blur(2px);
}

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  padding: 2rem;
  transition: margin-left var(--transition);
}

.main-content.sidebar-closed { margin-left: 0; }

/* ===== PAGE HEADER ===== */
.page-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }
.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 0.25rem 0;
}
.page-header p { color: var(--text-muted); margin: 0; font-size: 0.95rem; }

h1, h2, h3, h4, h5, h6 { color: var(--text-main); font-weight: 700; }
h1 { font-size: 1.75rem; margin-bottom: 1.5rem; }
h2 { font-size: 1.35rem; margin-bottom: 1rem; }

/* ===== CARDS ===== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--card-shadow);
  transition: box-shadow var(--transition);
}
.card-body { padding: 1.5rem; }
.card-title { font-weight: 700; color: var(--text-main); }

/* ===== STAT CARDS ===== */
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
  transition: box-shadow var(--transition), transform var(--transition);
  height: 100%;
}
.stat-card:hover { box-shadow: var(--card-shadow-hover); transform: translateY(-2px); }
.stat-card-icon { font-size: 2rem; margin-bottom: 0.75rem; display: block; }
.stat-card-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.35rem;
}
.stat-card-value { font-size: 2rem; font-weight: 700; color: var(--text-main); line-height: 1.2; }
.stat-card-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.3rem; }

/* ===== ACTIVITY CARDS (letzte Aktivitäten) ===== */
.activity-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--card-shadow);
  transition: box-shadow var(--transition), transform var(--transition);
  height: 100%;
}
.activity-card:hover { box-shadow: var(--card-shadow-hover); transform: translateY(-2px); }
.activity-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--accent-light);
  color: var(--accent-dark);
}
.activity-badge.wandern { background: #dcfce7; color: #166534; }
.activity-badge.fahrrad { background: #fef3c7; color: #92400e; }
.activity-date { font-size: 0.82rem; color: var(--text-muted); font-weight: 500; }
.activity-title { font-size: 1rem; font-weight: 600; color: var(--text-main); margin: 0.5rem 0; }
.activity-meta { display: flex; flex-wrap: wrap; gap: 0.6rem; font-size: 0.82rem; color: var(--text-muted); }

/* ===== JAHRESVERGLEICH ===== */
.year-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
  height: 100%;
}
.year-card-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem; }
.year-row { display: flex; align-items: center; justify-content: space-between; padding: 0.55rem 0; border-bottom: 1px solid var(--border); font-size: 0.875rem; }
.year-row:last-child { border-bottom: none; }
.year-row-year { font-weight: 700; color: var(--accent); min-width: 3.5rem; }
.year-row-stats { color: var(--text-muted); font-size: 0.82rem; }

/* ===== SPEZIAL STATS ===== */
.special-card {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 1.25rem;
  height: 100%;
}
.special-card-year { font-size: 1rem; font-weight: 700; color: var(--accent-dark); margin-bottom: 0.75rem; }
.special-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.7);
  margin-bottom: 0.4rem;
  font-size: 0.875rem;
}
.count-badge {
  background: var(--accent);
  color: white;
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 700;
  min-width: 2rem;
  text-align: center;
}

/* ===== SECTION HEADERS ===== */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.section-title { font-size: 1.2rem; font-weight: 700; color: var(--text-main); margin: 0; }

/* ===== FORMS ===== */
.form-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--card-shadow);
  max-width: 900px;
}
.form-label { font-size: 0.875rem; font-weight: 600; color: var(--text-main); margin-bottom: 0.4rem; }
.form-control, .form-select {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.625rem 0.875rem;
  font-size: 0.925rem;
  color: var(--text-main);
  background: var(--card-bg);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
  outline: none;
}
.form-control::placeholder { color: #94a3b8; }

/* ===== BUTTONS ===== */
.btn {
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.6rem 1.25rem;
  transition: all var(--transition);
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: white; border: none; }
.btn-primary:hover { background: var(--accent-dark); color: white; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,0.3); }
.btn-outline-secondary { background: transparent; border: 1.5px solid var(--border); color: var(--text-muted); }
.btn-outline-secondary:hover { background: var(--body-bg); border-color: #94a3b8; color: var(--text-main); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-danger { background: var(--danger); color: white; border: none; }
.btn-danger:hover { background: #dc2626; color: white; }
.btn-success { background: var(--success); color: white; border: none; }
.btn-success:hover { background: #059669; color: white; }
.btn-warning { background: var(--warning); color: white; border: none; }
.btn-warning:hover { background: #d97706; color: white; }

/* ===== LOADING SPINNER ===== */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 3rem 2rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== TABLES ===== */
.table-wrapper {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}
.table { margin: 0; font-size: 0.875rem; }
.table thead th {
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--border) !important;
  padding: 0.875rem 1rem;
  white-space: nowrap;
}
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: #f8fafc; }
.table tbody td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid #f1f5f9 !important;
  vertical-align: middle;
  color: var(--text-main);
}
.table tbody tr:last-child td { border-bottom: none !important; }

/* ===== ALERTS ===== */
.alert { border: none; border-radius: var(--radius-sm); padding: 0.875rem 1.25rem; font-size: 0.9rem; font-weight: 500; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-danger { background: #fee2e2; color: #991b1b; }
.alert-info { background: #dbeafe; color: #1e40af; }

/* ===== BADGES ===== */
.badge { border-radius: 999px; font-size: 0.78rem; font-weight: 600; padding: 0.3em 0.75em; }
.bg-primary { background: var(--accent) !important; }

/* ===== TYPEN LIST ===== */
.type-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.type-item:last-child { border-bottom: none; }
.type-item:hover { background: #f8fafc; }
.type-item-name { font-weight: 500; display: flex; align-items: center; gap: 0.5rem; }

/* ===== MODAL ===== */
.modal-content { border: none; border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0,0,0,0.15); }
.modal-header { background: #f8fafc; border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; padding: 1.25rem 1.5rem; }
.modal-title { font-weight: 700; font-size: 1.1rem; }
.modal-footer { border-top: 1px solid var(--border); padding: 1rem 1.5rem; }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 3rem 2rem; color: var(--text-muted); }
.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; display: block; opacity: 0.5; }
.empty-state-text { font-size: 1rem; margin-bottom: 0.5rem; }

/* ===== RESPONSIVE Desktop (>=901px) ===== */
@media (min-width: 901px) {
  .sidebar-toggle { display: none !important; }
  .sidebar-overlay { display: none !important; }
  .sidebar { transform: translateX(0) !important; }
  .sidebar.closed { transform: translateX(-100%) !important; }
  .main-content.sidebar-closed { margin-left: 0 !important; }
  .main-content { margin-left: var(--sidebar-width) !important; }
}

/* ===== RESPONSIVE Mobile (<=900px) ===== */
@media (max-width: 900px) {
  .sidebar-toggle { display: flex !important; }
  .sidebar { transform: translateX(-100%); width: min(280px, 85vw); }
  .sidebar.opened-mobile { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,0.25); }
  body.sidebar-open { overflow: hidden; touch-action: none; }
  .main-content { margin-left: 0 !important; padding: 1rem; padding-top: 4rem; }
  .form-card { padding: 1.25rem; }
  .page-header h1 { font-size: 1.4rem; padding-top: 0.25rem; }
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  h1 { font-size: 1.4rem; }
  h2 { font-size: 1.1rem; }
}

/* ===== UTILITY ===== */
.d-none { display: none !important; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }
.row { --bs-gutter-x: 1.5rem; }

/* ===== CHART CARDS ===== */
.chart-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 1.5rem;
  height: 100%;
}
.chart-card-title { font-size: 1rem; font-weight: 600; color: var(--text-main); margin-bottom: 1rem; }
.chart-wrapper { position: relative; height: 260px; }

/* ===== GOAL CARDS ===== */
.goal-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 1.5rem;
}
.goal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; font-weight: 600; color: var(--text-main); flex-wrap: wrap; gap: 0.5rem; }
.goal-value { font-size: 0.9rem; color: var(--accent); font-weight: 700; }
.goal-footer { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.5rem; }

/* ===== KALENDER ===== */
.cal-header { margin-bottom: 1rem; display: flex; align-items: center; gap: 1rem; }
.cal-year-label { font-weight: 600; color: var(--text-main); display: flex; align-items: center; gap: 0.5rem; }
.cal-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.cal-month { background: var(--card-bg); border-radius: var(--radius); padding: 1rem; box-shadow: var(--card-shadow); }
.cal-month-title { font-weight: 700; font-size: 0.9rem; color: var(--accent); margin-bottom: 0.5rem; text-align: center; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.cal-head { font-size: 0.65rem; color: var(--text-muted); text-align: center; padding: 2px 0; font-weight: 600; }
.cal-day {
  font-size: 0.7rem; text-align: center; padding: 3px 1px;
  border-radius: 4px; color: var(--text-muted); min-height: 22px; line-height: 16px;
  cursor: default;
}
.cal-day.active { color: #fff; font-weight: 700; cursor: help; }
.cal-day.active.level-1 { background: rgba(37,99,235,0.7); }
.cal-day.active.level-2 { background: rgba(37,99,235,0.9); }
.cal-day.active.level-3 { background: var(--accent); box-shadow: 0 0 0 2px rgba(37,99,235,0.3); }
.cal-legend { display: flex; align-items: center; gap: 0.5rem; margin-top: 1rem; font-size: 0.8rem; color: var(--text-muted); }

/* ===== GOAL EDIT ===== */
.goal-edit-card { border: 2px dashed var(--border); background: var(--body-bg); }
.goal-edit-title { font-weight: 600; font-size: 0.9rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.goal-edit-row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.goal-edit-row label { font-size: 0.85rem; color: var(--text-main); white-space: nowrap; margin: 0; }

/* ===== SEARCH BAR ===== */
.search-bar { max-width: 480px; }
.search-bar .form-control { border-radius: 10px; border: 1.5px solid var(--border); background: var(--card-bg); padding: 0.6rem 1rem; font-size: 0.95rem; }
.search-bar .form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); outline: none; }

/* ===== SCHWIERIGKEIT PUNKTE ===== */
.diff-dots { display:inline-flex; align-items:center; gap:2px; }
.diff-dot { display:inline-block; width:11px; height:11px; border-radius:50%; flex-shrink:0; }

/* ===== STAT CARDS (Streak) ===== */
.stat-card { background:var(--card-bg); border-radius:var(--radius); padding:1.25rem 1rem; box-shadow:var(--card-shadow); text-align:center; height:100%; }
.stat-card-icon { font-size:1.75rem; display:block; margin-bottom:0.4rem; }
.stat-card-title { font-size:0.8rem; font-weight:600; color:var(--text-muted); text-transform:uppercase; letter-spacing:.05em; margin-bottom:0.3rem; }
.stat-card-value { font-size:1.7rem; font-weight:800; color:var(--accent); line-height:1.1; }
.stat-card-value small { font-size:0.9rem; font-weight:500; color:var(--text-muted); }
.stat-card-sub { font-size:0.8rem; color:var(--text-muted); margin-top:0.25rem; }

/* ===== PAGINATION ===== */
.pag-bar { display:flex; gap:0.4rem; align-items:center; flex-wrap:wrap; justify-content:center; padding:1rem 0 0.5rem; }
.pag-bar .btn { min-width:36px; padding:0.3rem 0.6rem; }
.pag-info { font-size:0.85rem; color:var(--text-muted); }

/* ===== PAGE HEADER ACTIONS ===== */
@media (max-width: 900px) {
  .goal-header { flex-direction: column; align-items: flex-start; }
  .chart-wrapper { height: 200px; }
  .cal-container { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.75rem; }
  .cal-day { font-size: 0.62rem; }
}
