/* =========================================================
   SPORTIA DOJO - System Stylowania
   Wysokiej klasy interfejs Dojo & Klubu Sportowego
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800;900&display=swap');

:root {
  /* Brand Paleta Sportia */
  --brand-navy-950: #030d1a;
  --brand-navy-900: #06182e;
  --brand-navy-800: #0b2647;
  --brand-navy-700: #103663;
  --brand-blue: #004b93;
  --brand-cyan: #00b5f0;
  --brand-cyan-light: #38bdf8;
  --brand-cyan-glow: rgba(0, 181, 240, 0.25);

  /* Kolory Akcentu & Statusu */
  --color-success: #10b981;
  --color-success-bg: rgba(16, 185, 129, 0.12);
  --color-warning: #f59e0b;
  --color-warning-bg: rgba(245, 158, 11, 0.12);
  --color-danger: #ef4444;
  --color-danger-bg: rgba(239, 68, 68, 0.12);
  --color-info: #0284c7;
  --color-info-bg: rgba(2, 132, 199, 0.12);

  /* Motyw Jasny (Domyślny dla biura) */
  --bg-page: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-surface-alt: #f8fafc;
  --border-color: #e2e8f0;
  --border-color-subtle: #edf2f7;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --sidebar-width: 270px;
  --header-height: 72px;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Motyw Ciemny (Dark Mode Dojo) */
[data-theme="dark"] {
  --bg-page: #06111f;
  --bg-surface: #0a1b30;
  --bg-surface-elevated: #0f2744;
  --bg-surface-alt: #0d223c;
  --border-color: #173356;
  --border-color-subtle: #122842;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px 0 rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 24px -3px rgba(0, 0, 0, 0.45);
  --shadow-xl: 0 20px 30px -5px rgba(0, 0, 0, 0.6);
}

/* =========================================================
   Reset & Podstawy
   ========================================================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

h1, h2, h3, h4, h5, h6, .font-heading {
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.02em;
}

a {
  color: var(--brand-cyan);
  text-decoration: none;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* =========================================================
   Główny Szablon (Layout)
   ========================================================= */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Pasek Boczny (Sidebar) */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: transform var(--transition-normal);
}

.sidebar-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo-img {
  height: 44px;
  width: auto;
  object-fit: contain;
}

.brand-badge {
  font-size: 0.65rem;
  text-transform: uppercase;
  font-weight: 800;
  padding: 2px 6px;
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-cyan));
  color: white;
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-section-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-light);
  letter-spacing: 1px;
  padding: 0.75rem 0.75rem 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  color: var(--text-muted);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.nav-item:hover {
  background: var(--bg-surface-alt);
  color: var(--brand-cyan);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(0, 181, 240, 0.12), rgba(0, 75, 147, 0.08));
  color: var(--brand-cyan);
  font-weight: 600;
  border-left: 3px solid var(--brand-cyan);
}

.nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.nav-item:hover svg {
  transform: scale(1.1);
}

.nav-badge {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.badge-danger {
  background: var(--color-danger);
  color: white;
}

.badge-info {
  background: var(--color-info-bg);
  color: var(--color-info);
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-surface-alt);
}

.club-info-card {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.club-info-title {
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Obszar Główny (Main Content) */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Pasek Górny (Header) */
.top-header {
  height: var(--header-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  position: sticky;
  top: 0;
  z-index: 90;
  backdrop-filter: blur(8px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-main);
  padding: 0.5rem;
}

.search-box {
  position: relative;
  width: 320px;
}

.search-box input {
  width: 100%;
  padding: 0.55rem 0.85rem 0.55rem 2.25rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-surface-alt);
  color: var(--text-main);
  font-size: 0.88rem;
  outline: none;
  transition: all var(--transition-fast);
}

.search-box input:focus {
  border-color: var(--brand-cyan);
  box-shadow: 0 0 0 3px var(--brand-cyan-glow);
  background: var(--bg-surface);
}

.search-box svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  width: 16px;
  height: 16px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Role Selector Badge & Switcher */
.role-switcher-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-surface-alt);
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.role-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-light);
}

.role-select {
  background: transparent;
  border: none;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--brand-cyan);
  cursor: pointer;
  outline: none;
}

.theme-toggle-btn {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.theme-toggle-btn:hover {
  background: var(--border-color);
}

.header-refresh-btn {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.header-refresh-btn:hover {
  background: rgba(0, 159, 227, 0.12);
  color: var(--brand-blue, #009fe3);
  border-color: rgba(0, 159, 227, 0.4);
}

.header-refresh-btn:active {
  transform: scale(0.96);
}

.header-refresh-btn.spinning svg,
.header-refresh-btn.spinning #header-refresh-icon {
  animation: headerSpin 0.75s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  color: var(--brand-blue, #009fe3);
}

@keyframes headerSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media (max-width: 768px) {
  .header-refresh-btn .refresh-label {
    display: none;
  }
  .header-refresh-btn {
    width: 38px;
    padding: 0;
    justify-content: center;
  }
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0.75rem 0.35rem 0.35rem;
  background: var(--bg-surface-alt);
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-cyan));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.user-info-text {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
}

.user-role-tag {
  font-size: 0.68rem;
  color: var(--brand-cyan);
  font-weight: 600;
  text-transform: uppercase;
}

/* =========================================================
   Zawartość Stron (Views)
   ========================================================= */
.content-body {
  padding: 1.75rem;
  flex: 1;
}

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.view-title-group h1 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.view-subtitle {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 0.2rem;
}

.view-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* =========================================================
   Komponenty UI: Przyciski, Karty, Tabele
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  user-select: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-cyan));
  color: white;
  box-shadow: 0 4px 12px var(--brand-cyan-glow);
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface);
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--bg-surface-alt);
  border-color: var(--text-muted);
}

.btn-success {
  background: var(--color-success);
  color: white;
}

.btn-danger {
  background: var(--color-danger);
  color: white;
}

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

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
}

/* Karty Statystyk (Dashboard KPI) */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--brand-cyan);
}

.kpi-card.kpi-emerald::before { background: var(--color-success); }
.kpi-card.kpi-amber::before { background: var(--color-warning); }
.kpi-card.kpi-red::before { background: var(--color-danger); }

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--brand-cyan-glow);
  color: var(--brand-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-value {
  font-size: 2rem;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  color: var(--text-main);
  margin: 0.5rem 0 0.25rem;
  line-height: 1.1;
}

.kpi-subtext {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Sekcje Kart (Cards & Panels) */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-surface);
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-body {
  padding: 1.5rem;
}

/* Tabele Danych (Data Tables) */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.data-table th {
  background: var(--bg-surface-alt);
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color-subtle);
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background-color: var(--bg-surface-alt);
}

/* Pasy Karate (Karate Belts Badges) */
.belt-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid rgba(0,0,0,0.15);
}

.belt-white { background: #f8fafc; color: #1e293b; border-color: #cbd5e1; }
.belt-orange { background: #ea580c; color: #ffffff; }
.belt-red { background: #dc2626; color: #ffffff; }
.belt-purple { background: #7c3aed; color: #ffffff; }
.belt-blue { background: #0284c7; color: #ffffff; }
.belt-yellow { background: #eab308; color: #000000; font-weight: 800; }
.belt-green { background: #15803d; color: #ffffff; }
.belt-brown { background: #78350f; color: #ffffff; }
.belt-black { background: #000000; color: #f59e0b; border: 1px solid #f59e0b; }

.belt-stripe {
  width: 4px;
  height: 12px;
  background: #f59e0b;
  border-radius: 1px;
}

/* Status Pills */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.status-active, .status-paid, .status-passed, .status-valid {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.status-pending, .status-registered {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.status-partially_paid, .status-partial {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
  font-weight: 700;
}

.status-overdue, .status-failed, .status-expired {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.status-suspended {
  background: rgba(148, 163, 184, 0.15);
  color: #64748b;
}

/* Filtry i Wyszukiwarki Sekcji */
.filter-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  align-items: center;
}

.filter-select, .form-input, .form-select, .form-textarea {
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 0.88rem;
  outline: none;
  transition: all var(--transition-fast);
}

.filter-select:focus, .form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--brand-cyan);
  box-shadow: 0 0 0 3px var(--brand-cyan-glow);
}

/* Pigułki Sekcji (Section Tabs) */
.section-pill-list {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin-bottom: 1.25rem;
  scrollbar-width: thin;
}

.section-pill {
  padding: 0.45rem 0.95rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.section-pill:hover {
  background: var(--bg-surface-alt);
  color: var(--brand-cyan);
}

.section-pill.active {
  background: var(--brand-cyan);
  color: white;
  border-color: var(--brand-cyan);
  box-shadow: 0 2px 8px var(--brand-cyan-glow);
}

/* =========================================================
   Moduł Obecności - Widok Trenera (Mata & Tablet)
   ========================================================= */
.attendance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.attendance-card {
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all var(--transition-fast);
}

.attendance-card.present {
  border-color: var(--color-success);
  background: linear-gradient(to bottom, var(--bg-surface), var(--color-success-bg));
}

.attendance-card.absent {
  border-color: var(--color-danger);
  background: linear-gradient(to bottom, var(--bg-surface), var(--color-danger-bg));
}

.attendance-card.excused {
  border-color: var(--color-warning);
  background: linear-gradient(to bottom, var(--bg-surface), var(--color-warning-bg));
}

.att-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.att-member-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.att-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.35rem;
}

.att-btn {
  padding: 0.55rem 0.25rem;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-surface-alt);
  cursor: pointer;
  text-align: center;
  transition: all var(--transition-fast);
}

.att-btn.active-present {
  background: var(--color-success);
  color: white;
  border-color: var(--color-success);
}

.att-btn.active-absent {
  background: var(--color-danger);
  color: white;
  border-color: var(--color-danger);
}

.att-btn.active-excused {
  background: var(--color-warning);
  color: white;
  border-color: var(--color-warning);
}

/* =========================================================
   Modale & Nakładki
   ========================================================= */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(3, 13, 26, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.25rem;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  transform: scale(0.95) translateY(10px);
  transition: all var(--transition-normal);
}

.modal-backdrop.active .modal-dialog {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
}

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

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background: var(--bg-surface-alt);
}

/* =========================================================
   Certyfikat Egzaminacyjny / Dyplom Dojo (Print & Preview)
   ========================================================= */
.certificate-preview-container {
  background: #ffffff;
  color: #0b1a2d;
  padding: 2.5rem;
  border: 12px double #004b93;
  border-radius: 4px;
  text-align: center;
  position: relative;
  box-shadow: 0 10px 25px rgba(0,0,0,0.25);
  font-family: 'Outfit', serif;
  margin: 0 auto;
  max-width: 750px;
}

.cert-kanji-bg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 14rem;
  color: rgba(0, 75, 147, 0.04);
  font-family: 'Noto Serif JP', serif;
  pointer-events: none;
  user-select: none;
}

.cert-header-logo {
  height: 60px;
  margin-bottom: 1rem;
}

.cert-title-big {
  font-size: 2rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #004b93;
  margin-bottom: 0.25rem;
}

.cert-subtitle {
  font-size: 1.1rem;
  color: #64748b;
  font-weight: 500;
  margin-bottom: 1.5rem;
}

.cert-candidate-name {
  font-size: 2.25rem;
  font-weight: 800;
  color: #0f172a;
  border-bottom: 2px solid #00b5f0;
  display: inline-block;
  padding: 0 2rem 0.5rem;
  margin-bottom: 1rem;
}

.cert-belt-awarded {
  font-size: 1.5rem;
  font-weight: 800;
  color: #d97706;
  margin-bottom: 1.5rem;
}

.cert-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
}

.cert-seal-img {
  width: 90px;
  height: 90px;
}

.cert-sign-line {
  border-top: 1px solid #475569;
  width: 180px;
  padding-top: 0.35rem;
  font-size: 0.78rem;
  color: #475569;
  font-weight: 600;
}

/* =========================================================
   Powiadomienia Toast
   ========================================================= */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 9999;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--brand-cyan);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 280px;
  transform: translateX(100%);
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast.toast-success { border-left-color: var(--color-success); }
.toast.toast-danger { border-left-color: var(--color-danger); }
.toast.toast-warning { border-left-color: var(--color-warning); }

@keyframes toastIn {
  to { transform: translateX(0); }
}

/* =========================================================
   Układ Grafiku i Sesji Treningowych (Schedule Layout)
   ========================================================= */
.schedule-main-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1.5rem;
  align-items: start;
}

.session-list-item {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: all var(--transition-fast);
  border-left: 4px solid transparent;
}

.session-list-item:hover {
  background: var(--bg-surface-alt);
}

.session-list-item.selected {
  background: var(--bg-surface-alt);
  border-left-color: var(--brand-cyan);
}

/* Duże dotykowe przyciski obecności na smartfonie i tablecie (Thumb-friendly) */
.att-btn-touch {
  padding: 0.75rem 0.5rem;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface-alt);
  color: var(--text-muted);
  cursor: pointer;
  text-align: center;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.att-btn-touch.active-present {
  background: var(--color-success);
  color: white;
  border-color: var(--color-success);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.att-btn-touch.active-absent {
  background: var(--color-danger);
  color: white;
  border-color: var(--color-danger);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.att-btn-touch.active-excused {
  background: var(--color-warning);
  color: white;
  border-color: var(--color-warning);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.modal-dialog-large {
  max-width: 850px;
}

.modal-dialog-calibrator {
  width: 96vw !important;
  max-width: 1260px !important;
  max-height: 94vh !important;
  padding: 0 !important;
}

/* =========================================================
   Kalibrator Nadruku Dyplomu PUK (Polska Unia Karate)
   ========================================================= */
.puk-diploma-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1.414 / 1; /* Proporcje A4 poziomo */
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  margin: 0 auto;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.puk-diploma-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.puk-field {
  position: absolute;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  font-family: 'Outfit', 'Segoe UI', Arial, sans-serif;
  user-select: none;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.puk-field:hover {
  filter: drop-shadow(0 2px 6px rgba(0, 181, 240, 0.4));
}

.puk-field.selected {
  outline: 2px dashed #00b5f0 !important;
  outline-offset: 3px !important;
  background: rgba(0, 181, 240, 0.12) !important;
  box-shadow: 0 4px 12px rgba(0, 181, 240, 0.3) !important;
}

/* =========================================================
   Style Wydruku (@media print)
   ========================================================= */
@media print {
  @page {
    size: A4 portrait;
    margin: 10mm;
  }

  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  html, body {
    background: #ffffff !important;
    color: #0f172a !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
  }

  /* Ukryj elementy UI, paski, przyciski i nawigację */
  .sidebar, 
  .top-header, 
  .view-actions, 
  .filter-bar, 
  .modal-footer, 
  .btn, 
  button,
  .theme-toggle-btn, 
  .theme-toggle,
  .modal-header, 
  .modal-close-btn, 
  #toast-container,
  #global-loader,
  .ptr-indicator,
  .nav-item,
  .nav-section-label,
  #user-profile-menu,
  .view-header,
  .no-print {
    display: none !important;
  }

  /* 1. GDY MODAL JEST OTWARTY - CAŁKOWICIE UKRYJ TŁO APLIKACJI */
  body.modal-open #app-container,
  body.modal-open .app-container,
  body:has(.modal-backdrop.active) #app-container,
  body:has(.modal-backdrop.active) .app-container {
    display: none !important;
  }

  /* Wyświetlaj modal na pełną stronę w druku */
  .modal-backdrop.active {
    position: static !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    width: 100% !important;
    overflow: visible !important;
  }

  .modal-backdrop:not(.active) {
    display: none !important;
  }

  .modal-dialog {
    box-shadow: none !important;
    border: none !important;
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: transparent !important;
    transform: none !important;
  }

  .modal-body {
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
  }

  /* Szablony dokumentów (faktura, UPO, certyfikaty) */
  #printable-invoice-paper,
  #printable-upo-paper,
  .printable-document {
    box-shadow: none !important;
    border: none !important;
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 auto !important;
  }

  /* 2. GDY MODAL NIE JEST OTWARTY (druk np. grafiku z kalendarza) */
  body:not(.modal-open) .app-container {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }
  body:not(.modal-open) .main-wrapper,
  body:not(.modal-open) .content-body,
  body:not(.modal-open) #main-content-area {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }
  .timetable-sheet-table {
    font-size: 7.5pt !important;
  }

  /* 3. CERTYFIKATY I DYPLOMY PUK (A4 poziome) */
  @page landscape-diploma {
    size: A4 landscape;
    margin: 0;
  }
  .certificate-preview-container {
    box-shadow: none !important;
    border-width: 8px !important;
    max-width: 100% !important;
    page-break-after: always;
  }
  .puk-diploma-wrapper {
    page: landscape-diploma;
    border: none !important;
    box-shadow: none !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    aspect-ratio: auto !important;
    page-break-after: always;
  }
  /* Gdy drukujemy w trybie nadruku na gotowym blankiecie PUK - ukryj tła */
  .puk-mode-blank .puk-bg-preview {
    display: none !important;
    opacity: 0 !important;
  }

  .cert-editable-field {
    background: transparent !important;
    box-shadow: none !important;
    outline: none !important;
  }
}

/* =========================================================
   Interaktywny Edytor Zaświadczeń i Kart (Inline Editing)
   ========================================================= */
.cert-editable-field {
  outline: none;
  border-radius: 4px;
  transition: all 0.15s ease;
  position: relative;
}
.cert-editable-field:hover {
  background: rgba(0, 181, 240, 0.08) !important;
  box-shadow: 0 0 0 1.5px rgba(0, 181, 240, 0.45);
  cursor: text;
}
.cert-editable-field:focus {
  background: #ffffff !important;
  box-shadow: 0 0 0 2px #00b5f0, 0 4px 12px rgba(0, 181, 240, 0.2);
}

/* =========================================================
   Responsywność (Mobile / Tablet / iPhone)
   ========================================================= */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-wrapper {
    margin-left: 0;
  }
  .mobile-menu-btn {
    display: block;
  }
  .search-box {
    width: 150px;
  }
  .schedule-main-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .modal-dialog {
    width: 96vw;
    max-width: 96vw;
    max-height: 92vh;
    padding: 0;
  }
  .modal-body {
    padding: 1rem;
  }
  .view-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .view-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .view-actions .btn {
    flex: 1;
    min-width: 140px;
    justify-content: center;
  }
}

/* =========================================================
   Kalibrator Nadruku Certyfikatów PUK
   ========================================================= */
.modal-dialog-calibrator {
  max-width: 1260px !important;
  width: 95vw !important;
  max-height: 95vh !important;
}

.puk-diploma-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.puk-field {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  user-select: none;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.puk-field.selected {
  outline: 2px dashed #00b5f0;
  background: rgba(0, 181, 240, 0.18) !important;
  box-shadow: 0 0 14px rgba(0, 181, 240, 0.45);
}

/* =========================================================
   Ekran Logowania (Authentication Screen & RODO Guard)
   ========================================================= */
.login-screen-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 50% 25%, #0f2744 0%, #06101c 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 1.25rem;
  overflow-y: auto;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: rgba(13, 27, 44, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(0, 181, 240, 0.35);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.55), 0 0 35px rgba(0, 181, 240, 0.15);
  color: #f1f5f9;
  animation: fadeIn 0.3s ease-out;
}

[data-theme="light"] .login-screen-wrapper {
  background: radial-gradient(circle at 50% 25%, #ebf5ff 0%, #cbd5e1 100%);
}

[data-theme="light"] .login-card {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(0, 75, 147, 0.25);
  color: #0f172a;
  box-shadow: 0 20px 50px rgba(0, 75, 147, 0.15);
}

.login-card .form-input {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: inherit;
}

[data-theme="light"] .login-card .form-input {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #0f172a;
}

/* ===================================================
   KALENDARZ ZAJĘĆ (Arkusz Tygodniowy dojo w stylu Excel)
   =================================================== */
.timetable-sheet-table th, 
.timetable-sheet-table td {
  border-collapse: collapse;
}

.timetable-class-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 181, 240, 0.25) !important;
  border-color: var(--brand-blue) !important;
}

.empty-slot-hover:hover {
  background: rgba(0, 181, 240, 0.08);
  border: 1px dashed var(--brand-cyan) !important;
}

.empty-slot-hover:hover .slot-add-btn {
  opacity: 1 !important;
}

.group-pill {
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  border: 1.5px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.group-pill:hover {
  border-color: var(--brand-cyan);
  color: var(--brand-blue);
}

.group-pill.active {
  background: var(--brand-blue);
  color: #ffffff;
  border-color: var(--brand-blue);
  box-shadow: 0 2px 8px rgba(0, 75, 147, 0.3);
}

.group-pill.pill-candidate {
  border-left: 3px solid #f59e0b !important;
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
  font-weight: 800;
}

.group-pill.pill-candidate:hover {
  background: #fef3c7;
  color: #92400e;
}

.group-pill.pill-candidate.active {
  background: #f59e0b !important;
  color: #ffffff !important;
  border-color: #d97706 !important;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4) !important;
}

/* =========================================================
   Pull to Refresh (Gest Przeciągnięcia w Dół na Mobile)
   ========================================================= */
.ptr-indicator {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translate(-50%, -80px);
  z-index: 99999;
  background: var(--bg-surface);
  color: var(--brand-blue);
  border: 1.5px solid var(--border-color);
  border-radius: 999px;
  padding: 0.5rem 1.15rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16), 0 2px 6px rgba(0, 75, 147, 0.1);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.84rem;
  font-weight: 700;
  pointer-events: none;
  opacity: 0;
  will-change: transform, opacity;
}

.ptr-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0, 181, 240, 0.15);
  color: var(--brand-cyan);
  font-size: 0.95rem;
  font-weight: 900;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.ptr-icon.ptr-flipped {
  transform: rotate(180deg);
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}

.ptr-spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(0, 75, 147, 0.2);
  border-top-color: var(--brand-cyan);
  border-radius: 50%;
  animation: ptrSpinAnim 0.65s linear infinite;
}

@keyframes ptrSpinAnim {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.ptr-text {
  letter-spacing: -0.2px;
}




