/* ── Login Page ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-wrapper {
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 1;
}
.login-back {
  display: inline-block;
  margin-bottom: 20px;
  color: var(--text-light);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  transition: color 0.2s;
}
.login-back:hover { color: var(--primary); }
.login-card { padding: 44px 40px; }
.login-logo {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-dark);
  text-align: center;
  margin-bottom: 6px;
}
.login-title {
  text-align: center;
  margin-bottom: 6px;
  font-size: 1.8rem;
}
.login-subtitle {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 30px;
}
.login-error {
  display: none;
  background: rgba(229,62,62,0.08);
  border: 1px solid rgba(229,62,62,0.25);
  color: #c53030;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.88rem;
  margin-bottom: 14px;
}
.login-links {
  text-align: center;
  margin-top: 14px;
}
.login-links a {
  font-size: 0.86rem;
  color: var(--text-light);
  text-decoration: none;
  transition: color 0.2s;
}
.login-links a:hover { color: var(--primary); }
.login-demo {
  margin-top: 28px;
  padding: 14px 16px;
  background: rgba(139,94,196,0.07);
  border: 1px dashed rgba(139,94,196,0.25);
  border-radius: 10px;
  font-size: 0.8rem;
  color: var(--text-medium);
  text-align: center;
}
.login-demo code {
  background: rgba(139,94,196,0.12);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: monospace;
  color: var(--primary);
}

/* ── Course Dashboard Layout ── */
.course-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.course-layout {
  display: flex;
  flex: 1;
  min-height: calc(100vh - 64px);
}

/* ── Course Header ── */
.course-header {
  height: 64px;
  background: rgba(245,240,250,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.course-header-logo {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-dark);
  text-decoration: none;
  flex-shrink: 0;
}
.course-header-sep { flex: 1; }
.course-header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--text-medium);
}
.course-header-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, #9b6ed4, #6a4aad);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 0.85rem; font-weight: 700;
}
.course-logout-btn {
  background: none;
  border: 1px solid var(--card-border);
  color: var(--text-light);
  padding: 6px 14px;
  border-radius: 50px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.course-logout-btn:hover { border-color: var(--primary); color: var(--primary); }
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text-dark);
  padding: 4px;
}

/* ── Sidebar ── */
.course-sidebar {
  width: 280px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-right: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  padding: 28px 0;
  overflow-y: auto;
  transition: transform 0.3s ease;
}
.sidebar-section-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 800;
  color: var(--text-light);
  padding: 0 22px;
  margin-bottom: 10px;
}
.progress-wrap { padding: 0 22px 24px; }
.progress-label {
  display: flex; justify-content: space-between;
  font-size: 0.8rem; color: var(--text-light);
  margin-bottom: 6px;
}
.progress-bar-track {
  height: 6px;
  background: rgba(139,94,196,0.12);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #9b6ed4, #6a4aad);
  border-radius: 3px;
  transition: width 0.5s ease;
}
.sidebar-divider { height: 1px; background: var(--card-border); margin: 12px 22px 16px; }

/* ── Sidebar: przycisk materiałów ── */
.sidebar-mat-btn {
  display: flex; align-items: center; gap: 10px;
  width: calc(100% - 32px); margin: 0 16px 16px;
  padding: 11px 14px;
  background: none;
  border: 1.5px dashed rgba(139,94,196,0.35);
  border-radius: 12px; cursor: pointer;
  font-family: 'Nunito', sans-serif;
  font-size: 0.88rem; font-weight: 700;
  color: var(--text-medium);
  transition: all 0.2s; text-align: left;
}
.sidebar-mat-btn:hover {
  background: rgba(139,94,196,0.08);
  border-color: var(--primary); color: var(--primary);
}
.sidebar-mat-btn.active {
  background: rgba(139,94,196,0.12);
  border-color: var(--primary); border-style: solid;
  color: var(--primary);
}
.sidebar-mat-icon { font-size: 1.05rem; }

/* ── Katalog materiałów ── */
.mat-catalog { display: flex; flex-direction: column; gap: 10px; }
.mat-week {
  border: 1px solid var(--card-border);
  border-radius: 14px; overflow: hidden;
  transition: border-color 0.2s;
}
.mat-week.open { border-color: rgba(139,94,196,0.45); }
.mat-week-header {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; cursor: pointer;
  background: var(--card-bg); transition: background 0.15s;
}
.mat-week-header:hover { background: white; }
.mat-week-num {
  width: 30px; height: 30px; flex-shrink: 0;
  background: rgba(139,94,196,0.1);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 800; color: var(--primary);
}
.mat-week-info { flex: 1; }
.mat-week-title { font-weight: 700; font-size: 0.92rem; color: var(--text-dark); }
.mat-week-count { font-size: 0.78rem; color: var(--text-light); margin-top: 2px; }
.mat-chevron {
  font-size: 1.15rem; color: var(--primary);
  transition: transform 0.25s; flex-shrink: 0;
}
.mat-week.open .mat-chevron { transform: rotate(90deg); }
.mat-week-body {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  border-top: 0px solid var(--card-border);
  transition: max-height 0.4s ease, opacity 0.3s ease, border-top-width 0.1s;
}
.mat-week.open .mat-week-body {
  max-height: 700px;
  opacity: 1;
  border-top-width: 1px;
}
.mat-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 18px; text-decoration: none;
  border-bottom: 1px solid rgba(208,184,240,0.4);
  transition: background 0.15s; color: var(--text-dark);
}
.mat-item:last-child { border-bottom: none; }
.mat-item:hover { background: rgba(139,94,196,0.05); }
.mat-icon { font-size: 1.05rem; flex-shrink: 0; }
.mat-name { flex: 1; font-size: 0.88rem; color: var(--text-medium); }
.mat-open {
  font-size: 0.78rem; font-weight: 700;
  color: var(--primary); flex-shrink: 0;
}
.week-nav-list { list-style: none; padding: 0; }
.week-nav-item { position: relative; }
.week-nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 22px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
  color: var(--text-medium);
  text-align: left;
  transition: background 0.2s, color 0.2s;
  position: relative;
}
.week-nav-btn:hover:not(.locked) { background: rgba(139,94,196,0.07); }
.week-nav-btn.active {
  background: rgba(139,94,196,0.10);
  color: var(--primary);
  font-weight: 700;
}
.week-nav-btn.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}
.week-nav-btn.locked { cursor: not-allowed; opacity: 0.5; }
.week-nav-btn.completed .week-nav-num { background: #48bb78; }
.week-nav-num {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, #9b6ed4, #6a4aad);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 0.75rem; font-weight: 700;
  flex-shrink: 0;
}
.week-nav-btn.locked .week-nav-num { background: rgba(139,94,196,0.2); }
.week-nav-lock {
  margin-left: auto;
  font-size: 0.85rem;
  opacity: 0.6;
}
.week-nav-check { margin-left: auto; color: #48bb78; font-weight: 800; }

/* ── Main Content ── */
.course-main {
  flex: 1;
  overflow-y: auto;
  padding: 40px 48px;
  max-width: 860px;
}
.week-header { margin-bottom: 32px; }
.week-header-tag {
  display: inline-block;
  background: rgba(139,94,196,0.10);
  color: var(--primary);
  padding: 4px 14px;
  border-radius: 50px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.week-header h1 { font-size: 2.2rem; margin-bottom: 10px; }
.week-header p { font-size: 1.02rem; color: var(--text-medium); }

.lessons-section { margin-bottom: 36px; }
.lessons-title { font-size: 1rem; font-weight: 800; color: var(--text-dark); margin-bottom: 14px; font-family: 'Nunito', sans-serif; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.8rem; color: var(--text-light); }
.lesson-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.lesson-item {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  overflow: hidden;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.lesson-item.completed { border-color: rgba(72,187,120,0.35); }
.lesson-item.open { border-color: var(--primary); box-shadow: 0 4px 18px rgba(124,92,191,0.13); }
.lsn-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  cursor: pointer;
  transition: background 0.2s;
}
.lsn-row:hover { background: white; }
.lesson-num {
  width: 36px; height: 36px;
  background: rgba(139,94,196,0.08);
  border: 1px solid rgba(139,94,196,0.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.82rem; font-weight: 700;
  color: var(--primary); flex-shrink: 0;
}
.lesson-item.completed .lesson-num {
  background: rgba(72,187,120,0.12);
  border-color: rgba(72,187,120,0.3);
  color: #276749;
}
.lesson-info { flex: 1; }
.lesson-title { font-weight: 700; color: var(--text-dark); font-size: 0.95rem; margin-bottom: 2px; }
.lesson-meta { font-size: 0.8rem; color: var(--text-light); }
.lesson-type {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-light);
  background: rgba(139,94,196,0.07);
  padding: 3px 10px;
  border-radius: 50px;
  flex-shrink: 0;
}
.lsn-chevron {
  font-size: 1.2rem; color: var(--primary); flex-shrink: 0;
  transition: transform 0.25s; line-height: 1; margin-left: 4px;
}
.lesson-item.open .lsn-chevron { transform: rotate(90deg); }
.lsn-body {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  padding: 0 24px 0 72px;
  font-size: 0.92rem;
  line-height: 1.75;
  color: var(--text-medium);
  border-top: 0px solid var(--card-border);
  transition: max-height 0.4s ease, opacity 0.3s ease, padding 0.3s ease, border-top-width 0.1s;
}
.lesson-item.open .lsn-body {
  max-height: 900px;
  opacity: 1;
  padding: 18px 24px 22px 72px;
  border-top-width: 1px;
}
.lsn-body p { margin-bottom: 10px; }
.lsn-body ul { margin: 8px 0 12px 18px; }
.lsn-body li { margin-bottom: 5px; }
.lsn-body strong { color: var(--text-dark); }
.lsn-body .lsn-tip {
  background: #ede7f6; border-left: 3px solid var(--primary);
  padding: 10px 14px; border-radius: 0 8px 8px 0;
  font-size: 0.88rem; margin: 12px 0;
}
.lesson-check { color: #48bb78; font-size: 1.2rem; font-weight: 800; }

.week-materials { margin-bottom: 36px; }
.materials-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.material-card {
  background: rgba(139,94,196,0.05);
  border: 1px solid rgba(139,94,196,0.15);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.material-card:hover { background: rgba(139,94,196,0.10); transform: translateY(-2px); }
.material-icon { font-size: 1.5rem; }
.material-info { }
.material-name { font-size: 0.88rem; font-weight: 700; color: var(--text-dark); }
.material-type { font-size: 0.75rem; color: var(--text-light); }

.complete-section {
  padding: 28px;
  background: rgba(139,94,196,0.05);
  border: 1px solid rgba(139,94,196,0.15);
  border-radius: 18px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.complete-text { flex: 1; }
.complete-text h4 { margin-bottom: 4px; font-size: 1.05rem; }
.complete-text p { font-size: 0.87rem; color: var(--text-light); }
.complete-btn {
  background: linear-gradient(135deg, #48bb78, #276749);
  color: white;
  border: none;
  padding: 12px 28px;
  border-radius: 50px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 16px rgba(72,187,120,0.3);
  white-space: nowrap;
}
.complete-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(72,187,120,0.4); }
.complete-btn:disabled {
  background: linear-gradient(135deg, #48bb78, #276749);
  opacity: 0.7;
  cursor: default;
  transform: none;
}
.complete-btn.done {
  background: rgba(72,187,120,0.12);
  color: #276749;
  border: 1px solid rgba(72,187,120,0.3);
  box-shadow: none;
}

.locked-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  text-align: center;
  padding: 40px;
}
.locked-icon { font-size: 4rem; margin-bottom: 20px; opacity: 0.5; }
.locked-overlay h2 { margin-bottom: 12px; }
.locked-overlay p { color: var(--text-light); max-width: 360px; }

/* ── Responsive course ── */
@media (max-width: 900px) {
  .course-main { padding: 28px 28px; }
  .materials-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .sidebar-toggle { display: block; }
  .course-sidebar {
    position: fixed;
    top: 64px; left: 0; bottom: 0;
    z-index: 40;
    transform: translateX(-100%);
    width: 280px;
    box-shadow: 4px 0 24px rgba(0,0,0,0.12);
  }
  .course-sidebar.open { transform: translateX(0); }
  .course-main { padding: 24px 20px; }
  .week-header h1 { font-size: 1.75rem; }
  .complete-section { flex-direction: column; text-align: center; }
  .complete-btn { width: 100%; justify-content: center; }
}

@media (max-width: 400px) {
  .login-card { padding: 32px 22px; }
}

/* ══════════════════════════════════════════
   ANIMACJE
══════════════════════════════════════════ */

/* ── Keyframes ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-14px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 4px 16px rgba(72,187,120,0.30); }
  50%       { box-shadow: 0 6px 28px rgba(72,187,120,0.55); }
}
@keyframes tagPop {
  from { opacity: 0; transform: scale(0.8) translateY(6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes barGrow {
  from { transform: scaleX(0); transform-origin: left; }
  to   { transform: scaleX(1); transform-origin: left; }
}

/* ── Wejście karty logowania ── */
.login-wrapper { animation: scaleIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both; }

/* ── Header ── */
.course-header { animation: fadeIn 0.35s ease both; }

/* ── Nagłówek tygodnia — animowane elementy po kolei ── */
.week-header         { animation: fadeInUp 0.38s ease both; }
.week-header-tag     { animation: tagPop 0.35s 0.05s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.week-header h1      { animation: fadeInUp 0.38s 0.08s ease both; }
.week-header p       { animation: fadeInUp 0.38s 0.14s ease both; }

/* ── Sekcje treści ── */
.lessons-section { animation: fadeInUp 0.4s 0.10s ease both; }
.week-materials  { animation: fadeInUp 0.4s 0.18s ease both; }
.complete-section { animation: fadeInUp 0.4s 0.26s ease both; }
.mat-catalog     { animation: fadeInUp 0.4s 0.08s ease both; }

/* ── Lekcje — staggered ── */
.lesson-item:nth-child(1)  { animation: fadeInUp 0.35s 0.12s ease both; }
.lesson-item:nth-child(2)  { animation: fadeInUp 0.35s 0.18s ease both; }
.lesson-item:nth-child(3)  { animation: fadeInUp 0.35s 0.24s ease both; }
.lesson-item:nth-child(4)  { animation: fadeInUp 0.35s 0.30s ease both; }
.lesson-item:nth-child(5)  { animation: fadeInUp 0.35s 0.36s ease both; }
.lesson-item:nth-child(6)  { animation: fadeInUp 0.35s 0.42s ease both; }

/* ── Karty materiałów — spring hover ── */
.material-card {
  transition: all 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.material-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 10px 28px rgba(124,92,191,0.18);
  border-color: rgba(139,94,196,0.35);
}

/* ── Sidebar nawigacja — slide in ── */
.week-nav-item:nth-child(1)  { animation: slideInLeft 0.3s 0.05s ease both; }
.week-nav-item:nth-child(2)  { animation: slideInLeft 0.3s 0.09s ease both; }
.week-nav-item:nth-child(3)  { animation: slideInLeft 0.3s 0.13s ease both; }
.week-nav-item:nth-child(4)  { animation: slideInLeft 0.3s 0.17s ease both; }
.week-nav-item:nth-child(5)  { animation: slideInLeft 0.3s 0.21s ease both; }
.week-nav-item:nth-child(6)  { animation: slideInLeft 0.3s 0.25s ease both; }
.week-nav-item:nth-child(7)  { animation: slideInLeft 0.3s 0.29s ease both; }
.week-nav-item:nth-child(8)  { animation: slideInLeft 0.3s 0.33s ease both; }

/* ── Sidebar btn – lepszy hover ── */
.week-nav-btn {
  transition: background 0.2s, color 0.2s, padding-left 0.2s;
}
.week-nav-btn:hover:not(.locked) {
  background: rgba(139,94,196,0.08);
  padding-left: 26px;
}
.week-nav-btn.active { padding-left: 26px; }

/* ── Active indicator – animacja ── */
.week-nav-btn.active::before {
  animation: slideInLeft 0.2s ease both;
}

/* ── Przycisk materiałów – pulse ── */
.sidebar-mat-btn:not(.active) {
  animation: none;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.sidebar-mat-btn:hover:not(.active) {
  transform: scale(1.02);
}
.sidebar-mat-btn.active {
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Tygodnie w katalogu – stagger ── */
.mat-week:nth-child(1) { animation: fadeInUp 0.35s 0.08s ease both; }
.mat-week:nth-child(2) { animation: fadeInUp 0.35s 0.13s ease both; }
.mat-week:nth-child(3) { animation: fadeInUp 0.35s 0.18s ease both; }
.mat-week:nth-child(4) { animation: fadeInUp 0.35s 0.23s ease both; }
.mat-week:nth-child(5) { animation: fadeInUp 0.35s 0.28s ease both; }
.mat-week:nth-child(6) { animation: fadeInUp 0.35s 0.33s ease both; }
.mat-week:nth-child(7) { animation: fadeInUp 0.35s 0.38s ease both; }
.mat-week:nth-child(8) { animation: fadeInUp 0.35s 0.43s ease both; }

/* ── Mat-week header spring hover ── */
.mat-week-header { transition: background 0.2s, padding-left 0.2s; }
.mat-week-header:hover { background: white; padding-left: 22px; }

/* ── Mat item hover ── */
.mat-item { transition: background 0.2s, padding-left 0.18s; }
.mat-item:hover { background: rgba(139,94,196,0.06); padding-left: 22px; }

/* ── Przycisk ukończenia – pulsuje gdy aktywny ── */
.complete-btn:not(.done):not(:disabled) {
  animation: pulseGlow 2.8s ease-in-out infinite;
}
.complete-btn { transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
.complete-btn:hover:not(.done):not(:disabled) {
  transform: translateY(-3px) scale(1.03);
  animation: none;
  box-shadow: 0 10px 30px rgba(72,187,120,0.45);
}

/* ── Locked – ikona pływa ── */
.locked-icon {
  animation: float 3.2s ease-in-out infinite;
  display: inline-block;
}

/* ── Chevron – płynniejszy ── */
.lsn-chevron { transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
.lesson-item.open .lsn-chevron { transform: rotate(90deg) scale(1.15); }
.mat-chevron  { transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
.mat-week.open .mat-chevron { transform: rotate(90deg) scale(1.15); }

/* ── Progress bar – animacja przy wczytaniu ── */
.progress-bar-fill { animation: barGrow 0.8s 0.4s cubic-bezier(0.65, 0, 0.35, 1) both; }

/* ── Zmiana tygodnia – efekt fade dla course-main ── */
.course-main.switching {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}
.course-main { transition: opacity 0.25s ease, transform 0.25s ease; }
