/* ── Trainer Dashboard – Seitenspezifisch ───────── */

/* Widget-Scroll-Fix (identisch zum Admin-Dashboard)
 * Das globale Bundle adressiert nur die alte Klasse `.cf-card-body`; die Widgets
 * nutzen aber `.cf-card__body` (BEM). Ohne flex:1 + min-height:0 + overflow wird
 * zu hoher Inhalt im fixhohen Grid-Item abgeschnitten und ist nicht scrollbar. */
.grid-stack-item-content > .cf-card > .cf-card__body,
.grid-stack-item-content > .cf-widget > .cf-card__body,
.grid-stack-item-content > .cf-card > .cf-card-body,
.grid-stack-item-content > .cf-widget > .cf-card-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}
.grid-stack-item-content > .cf-card > .cf-card__header,
.grid-stack-item-content > .cf-widget > .cf-card__header {
  flex-shrink: 0;
}

/* Dashboard Content Wrapper */
.cf-dashboard-content {
  padding: 18px 22px 20px;
  margin-top: calc(var(--cf-topbar-height) + 8px);
  position: relative;
  overflow: hidden;
}

.cf-dashboard-content.cf-dashboard-loading .grid-stack {
  visibility: hidden;
}

.cf-dashboard-loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px 22px;
  background: var(--cf-bg-body, #f8fafc);
  opacity: 0;
  pointer-events: none;
  transition: opacity .24s ease;
}

.cf-dashboard-content.cf-dashboard-loading .cf-dashboard-loading-overlay {
  opacity: 1;
  pointer-events: none;
}

.cf-new-clubflex-banner {
  position: relative;
  z-index: 21;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin: 0 0 16px;
  padding: 18px 20px;
  border: 1px solid rgba(79, 70, 229, 0.18);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(79, 70, 229, 0.10), rgba(14, 165, 233, 0.07)),
    var(--cf-bg-card, #fff);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  transition: opacity .18s ease, transform .18s ease, margin .18s ease, padding .18s ease, max-height .18s ease;
}

.cf-new-clubflex-banner::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--cf-primary, #4f46e5), var(--cf-info, #0ea5e9));
}

.cf-new-clubflex-banner.is-hidden {
  display: none;
}

.cf-new-clubflex-banner.is-dismissed {
  opacity: 0;
  transform: translateY(-6px);
  max-height: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
  pointer-events: none;
}

.cf-new-clubflex-banner__icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background: rgba(255, 107, 25, .10);
  box-shadow: 0 8px 18px rgba(255, 107, 25, .12);
}

.cf-new-clubflex-banner__icon .cf-brand-mark { --cf-brand-mark-size: 30px; }

.cf-new-clubflex-banner__body {
  flex: 1 1 auto;
  min-width: 0;
  padding-top: 1px;
}

.cf-new-clubflex-banner__body h2 {
  margin: 0 0 4px;
  color: var(--cf-text-primary, #0f172a);
  font-size: 18px;
  line-height: 1.25;
  font-weight: 850;
  letter-spacing: 0;
}

.cf-new-clubflex-banner__body p {
  margin: 0;
  color: var(--cf-text-secondary, #64748b);
  font-size: 13.5px;
  line-height: 1.5;
  max-width: 980px;
}

.cf-new-clubflex-banner__close {
  appearance: none;
  width: 34px;
  height: 34px;
  border: 1px solid var(--cf-border, #e2e8f0);
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: var(--cf-text-muted, #94a3b8);
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease, transform .15s ease;
}

.cf-new-clubflex-banner__close:hover {
  color: var(--cf-text-primary, #0f172a);
  border-color: rgba(79, 70, 229, 0.25);
  background: var(--cf-bg-card, #fff);
  transform: translateY(-1px);
}

body.dark-mode .cf-new-clubflex-banner {
  border-color: rgba(96, 165, 250, 0.25);
  background:
    linear-gradient(135deg, rgba(79, 70, 229, 0.20), rgba(14, 165, 233, 0.10)),
    var(--cf-bg-card, #0f172a);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.28);
}

body.dark-mode .cf-new-clubflex-banner__close {
  background: rgba(15, 23, 42, 0.72);
  border-color: rgba(148, 163, 184, 0.24);
}

.cf-dashboard-loading-shell {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cf-dashboard-loading-spinner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--cf-text-secondary, #64748b);
  font-size: var(--cf-type-body);
  font-weight: 700;
}

.cf-dashboard-loading-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.cf-dashboard-loading-card {
  min-height: 112px;
  border-radius: 14px;
  border: 1px solid var(--cf-border, rgba(15, 23, 42, .08));
  background: linear-gradient(90deg, rgba(148, 163, 184, .16) 25%, rgba(148, 163, 184, .30) 37%, rgba(148, 163, 184, .16) 63%);
  background-size: 360% 100%;
  animation: cfDashSkeleton 1.25s ease-in-out infinite;
}

.cf-dashboard-loading-card.is-wide {
  grid-column: span 2;
}

.cf-dashboard-loading-card.is-tall {
  min-height: 168px;
}

@keyframes cfDashSkeleton {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

.cf-dashboard-content.cf-dashboard-static-fallback .grid-stack {
  display: grid !important;
  grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
  gap: 16px !important;
  min-height: 0 !important;
  height: auto !important;
  position: relative !important;
  visibility: visible !important;
}

.cf-dashboard-content.cf-dashboard-static-fallback .grid-stack > .grid-stack-item {
  position: relative !important;
  inset: auto !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  width: auto !important;
  height: auto !important;
  min-height: 220px;
  margin: 0 !important;
  transform: none !important;
  grid-column: span 4;
}

.cf-dashboard-content.cf-dashboard-static-fallback .grid-stack > .grid-stack-item[gs-w="12"] { grid-column: span 12; }
.cf-dashboard-content.cf-dashboard-static-fallback .grid-stack > .grid-stack-item[gs-w="8"] { grid-column: span 8; }
.cf-dashboard-content.cf-dashboard-static-fallback .grid-stack > .grid-stack-item[gs-w="6"] { grid-column: span 6; }
.cf-dashboard-content.cf-dashboard-static-fallback .grid-stack > .grid-stack-item[gs-w="4"] { grid-column: span 4; }
.cf-dashboard-content.cf-dashboard-static-fallback .grid-stack > .grid-stack-item[gs-w="3"] { grid-column: span 3; }

.cf-dashboard-content.cf-dashboard-static-fallback .grid-stack > .grid-stack-item[gs-h="1"] { min-height: 82px; }
.cf-dashboard-content.cf-dashboard-static-fallback .grid-stack > .grid-stack-item[gs-h="2"] { min-height: 152px; }
.cf-dashboard-content.cf-dashboard-static-fallback .grid-stack > .grid-stack-item[gs-h="3"] { min-height: 220px; }
.cf-dashboard-content.cf-dashboard-static-fallback .grid-stack > .grid-stack-item[gs-h="4"] { min-height: 288px; }
.cf-dashboard-content.cf-dashboard-static-fallback .grid-stack > .grid-stack-item[gs-h="5"] { min-height: 356px; }
.cf-dashboard-content.cf-dashboard-static-fallback .grid-stack > .grid-stack-item[gs-h="6"] { min-height: 424px; }

.cf-dashboard-content.cf-dashboard-static-fallback .grid-stack > .grid-stack-item[gs-id="welcome"] { order: 0; }
.cf-dashboard-content.cf-dashboard-static-fallback .grid-stack > .grid-stack-item[gs-id="billing_banner"] { order: 1; }
.cf-dashboard-content.cf-dashboard-static-fallback .grid-stack > .grid-stack-item[gs-id="next_session"] { order: 2; }
.cf-dashboard-content.cf-dashboard-static-fallback .grid-stack > .grid-stack-item[gs-id="kpis"] { order: 3; }
.cf-dashboard-content.cf-dashboard-static-fallback .grid-stack > .grid-stack-item[gs-id="billing_status"] { order: 4; }
.cf-dashboard-content.cf-dashboard-static-fallback .grid-stack > .grid-stack-item[gs-id="billable_units"] { order: 5; }
.cf-dashboard-content.cf-dashboard-static-fallback .grid-stack > .grid-stack-item[gs-id="schedule"] { order: 6; }
.cf-dashboard-content.cf-dashboard-static-fallback .grid-stack > .grid-stack-item[gs-id="messages"] { order: 7; }
.cf-dashboard-content.cf-dashboard-static-fallback .grid-stack > .grid-stack-item[gs-id="quick_access"] { order: 8; }
.cf-dashboard-content.cf-dashboard-static-fallback .grid-stack > .grid-stack-item[gs-id="recent_attendance"] { order: 9; }
.cf-dashboard-content.cf-dashboard-static-fallback .grid-stack > .grid-stack-item[gs-id="open_tasks"] { order: 10; }
.cf-dashboard-content.cf-dashboard-static-fallback .grid-stack > .grid-stack-item[gs-id="attendance_chart"] { order: 11; }
.cf-dashboard-content.cf-dashboard-static-fallback .grid-stack > .grid-stack-item[gs-id="groups"] { order: 12; }
.cf-dashboard-content.cf-dashboard-static-fallback .grid-stack > .grid-stack-item[gs-id="quick_attendance"] { order: 13; }
.cf-dashboard-content.cf-dashboard-static-fallback .grid-stack > .grid-stack-item[gs-id="calendar"] { order: 14; }
.cf-dashboard-content.cf-dashboard-static-fallback .grid-stack > .grid-stack-item[gs-id="personal_stats"] { order: 15; }
.cf-dashboard-content.cf-dashboard-static-fallback .grid-stack > .grid-stack-item[gs-id="birthdays"] { order: 16; }
.cf-dashboard-content.cf-dashboard-static-fallback .grid-stack > .grid-stack-item[gs-id="weather"] { order: 17; }

.cf-dashboard-content.cf-dashboard-static-fallback .grid-stack-item-content {
  position: relative !important;
  inset: auto !important;
  width: 100% !important;
  height: auto !important;
  min-height: inherit;
}

.cf-dashboard-content .grid-stack-item[gs-id="welcome"] > .grid-stack-item-content,
.cf-dashboard-content .grid-stack-item[gs-id="billing_banner"] > .grid-stack-item-content,
.cf-dashboard-content .grid-stack-item[gs-id="next_session"] > .grid-stack-item-content,
.cf-dashboard-content .grid-stack-item[gs-id="kpis"] > .grid-stack-item-content {
  min-height: 0;
}

/* ── Welcome Banner ───────────────────────────── */
.cf-dashboard-content .cf-welcome-banner {
  padding: 18px 22px;
  gap: 16px;
  margin-bottom: 0;
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(2, 8, 23, 0.14);
}

.cf-dashboard-content .cf-dashboard-avatar {
  width: 54px;
  height: 54px;
  font-size: 18px;
  background: rgba(255, 255, 255, .16);
  color: #fff;
  border: 2px solid rgba(255, 255, 255, .45);
}

.cf-dashboard-content .cf-welcome-banner-content { gap: 14px; }
.cf-dashboard-content .cf-welcome-banner-text h1 { font-size: 22px; margin-bottom: 2px; }
.cf-dashboard-content .cf-welcome-banner-text p { font-size: var(--cf-type-body); line-height: 1.4; }

/* Banner-Buttons */
.btn-banner,
.btn-banner-secondary {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-weight: 600;
  border: none;
  box-shadow: none;
  padding: 8px 14px;
  font-size: var(--cf-type-caption);
  border-radius: 10px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .2s;
}

.btn-banner:hover { background: rgba(255, 255, 255, 0.32); color: #fff; }
.btn-banner-secondary { background: rgba(255, 255, 255, 0.12); }
.btn-banner-secondary:hover { background: rgba(255, 255, 255, 0.24); color: #fff; }

/* ── Nächste Einheit ──────────────────────────── */
.cf-next-session-banner,
.cf-next-session-skeleton {
  background: linear-gradient(135deg, var(--cf-primary), var(--cf-primary-dark, #0284C7));
  border-radius: var(--cf-radius-lg);
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--cf-shadow-primary);
}

.cf-next-session-shape-1,
.cf-next-session-banner::before,
.cf-next-session-skeleton::before {
  content: '';
  position: absolute;
  right: -30px;
  top: -40px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
}

.cf-next-session-shape-2 {
  position: absolute;
  right: 80px;
  bottom: -50px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
}

.cf-next-session-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 20px;
}

.cf-next-session-icon,
.cf-next-session-skeleton-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--cf-type-title);
  flex-shrink: 0;
}

.cf-next-session-label,
.cf-next-session-skeleton-label {
  font-size: var(--cf-type-meta);
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, .7);
  font-weight: 700;
  margin-bottom: 3px;
}

.cf-next-session-title {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.3px;
}

.cf-next-session-meta {
  font-size: 13.5px;
  color: rgba(255, 255, 255, .8);
  margin-top: 4px;
}

.cf-next-session-link {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, .18);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--cf-radius-sm);
  font-weight: 700;
  font-size: 13.5px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: background .2s;
}

.cf-next-session-link:hover {
  background: rgba(255, 255, 255, .28);
  color: #fff;
}

/* ── Schnellzugriff-Links ─────────────────────── */
.cf-quick-link-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 10px;
  border-radius: var(--cf-radius-md, 10px);
  background: var(--cf-bg-body);
  text-decoration: none;
  transition: transform .15s, box-shadow .15s, background .15s;
  border: 1px solid transparent;
}

.cf-quick-link-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  background: var(--cf-bg-card);
  border-color: var(--cf-border);
}

.cf-quick-link-item i {
  font-size: 18px;
}

.cf-quick-link-item span {
  font-weight: 600;
  font-size: var(--cf-type-caption);
  color: var(--cf-text-primary);
  text-align: center;
}

/* ── KPI / Stat Cards ─────────────────────────── */
.cf-dashboard-content .cf-grid-4.mb-24 { margin-bottom: 0 !important; gap: 14px; }
.cf-dashboard-content .cf-stat-card { padding: 14px; border-radius: 12px; gap: 10px; }
.cf-dashboard-content .cf-stat-icon { width: 38px; height: 38px; font-size: 15px; }
.cf-dashboard-content .cf-stat-label { font-size: var(--cf-type-meta); margin-top: 0; }
.cf-dashboard-content .cf-stat-value { font-size: 22px; letter-spacing: -0.4px; }
.cf-dashboard-content .cf-trend-badge { margin-top: 10px !important; padding: 4px 8px; font-size: var(--cf-type-meta); }

/* ── Card Kompakt-Stile ───────────────────────── */
.cf-dashboard-content .cf-card { border-radius: 0; box-shadow: none; }
.cf-dashboard-content .cf-card__header,
.cf-dashboard-content .cf-card-header { padding: 12px 14px; min-height: auto; }
.cf-dashboard-content .cf-card__title,
.cf-dashboard-content .cf-card-title { font-size: var(--cf-type-body); letter-spacing: .01em; }
.cf-dashboard-content .cf-card__subtitle { font-size: var(--cf-type-caption); }
.cf-dashboard-content .cf-card__body,
.cf-dashboard-content .cf-card-body { padding: 14px; }
.cf-dashboard-content .cf-card-ghost { padding: 10px; border-radius: 10px; }
.cf-dashboard-content .cf-card-ghost i { font-size: var(--cf-type-section); }

/* ── Progress-Balken ──────────────────────────── */
.cf-progress {
  height: 8px;
  background: var(--cf-border);
  border-radius: 4px;
  overflow: hidden;
}

.cf-progress-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--cf-primary), var(--cf-primary-light));
  transition: width .5s ease;
}

/* ── Leere Zustände ───────────────────────────── */
.cf-widget-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  text-align: center;
  color: var(--cf-text-muted);
  min-height: 80px;
}

.cf-widget-empty i {
  font-size: 22px;
  margin-bottom: 8px;
  opacity: 0.5;
}

.cf-widget-empty p {
  font-size: var(--cf-type-body);
  margin: 0;
}

/* ── Schnell-Anwesenheit Buttons ──────────────── */
.cf-qa-btns {
  display: flex;
  gap: 6px;
}

.cf-qa-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--cf-border);
  background: var(--cf-bg-card);
  color: var(--cf-text-muted);
  cursor: pointer;
  transition: all .2s;
  font-size: var(--cf-type-meta);
}

.cf-qa-btn:hover {
  border-color: var(--cf-primary);
  color: var(--cf-primary);
  background: var(--cf-bg-body);
}

.cf-qa-btn.active-present { 
  background: var(--cf-success); 
  color: #fff; 
  border-color: var(--cf-success);
  box-shadow: 0 4px 10px rgba(34, 197, 94, 0.2);
}

.cf-qa-btn.active-absent { 
  background: var(--cf-danger); 
  color: #fff; 
  border-color: var(--cf-danger);
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.2);
}

.cf-qa-btn.active-excused { 
  background: var(--cf-warning); 
  color: #fff; 
  border-color: var(--cf-warning);
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.2);
}

@media (max-width: 900px) {
  .cf-new-clubflex-banner {
    flex-direction: column;
    padding: 16px;
  }

  .cf-new-clubflex-banner__close {
    position: absolute;
    top: 12px;
    right: 12px;
  }

  .cf-new-clubflex-banner__body {
    padding-right: 34px;
  }

  .cf-dashboard-loading-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cf-dashboard-content.cf-dashboard-static-fallback .grid-stack {
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  }

  .cf-dashboard-content.cf-dashboard-static-fallback .grid-stack > .grid-stack-item,
  .cf-dashboard-content.cf-dashboard-static-fallback .grid-stack > .grid-stack-item[gs-w] {
    grid-column: span 6;
  }
}

@media (max-width: 640px) {
  .cf-dashboard-loading-grid {
    grid-template-columns: 1fr;
  }
  .cf-dashboard-loading-card.is-wide {
    grid-column: span 1;
  }

  .cf-dashboard-content.cf-dashboard-static-fallback .grid-stack {
    grid-template-columns: 1fr !important;
  }

  .cf-dashboard-content.cf-dashboard-static-fallback .grid-stack > .grid-stack-item,
  .cf-dashboard-content.cf-dashboard-static-fallback .grid-stack > .grid-stack-item[gs-w] {
    grid-column: 1 / -1;
  }
}
