/* Local fonts loaded by theme */
#swl-app-container {
  --bg:          #0a0a0a;
  --surface:     #111111;
  --surface2:    #161616;
  --border:      #1f1f1f;
  --border2:     #2a2a2a;
  --accent:      #00e87a;
  --accent-bg:   rgba(0,232,122,0.06);
  --text:        #e2e2e2;
  --text-2:      #7a7a7a;
  --text-3:      #3a3a3a;
  --mono:        'JetBrains Mono', monospace;
  --sans:        'Inter', sans-serif;
  --r:           5px;
  
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  box-sizing: border-box;
  position: relative;
  height: calc(100vh - var(--navbar-height, 80px));
  max-height: calc(100vh - var(--navbar-height, 80px));
  overflow: hidden;
  border: none;
  border-top: 1px solid var(--border);
  border-radius: 0;
}

#swl-app-container * {
  box-sizing: border-box;
}

/* LAYOUT */
.app {
  display: grid;
  grid-template-columns: 300px 1fr;
  height: 100%;
}

/* SIDEBAR */
.sidebar {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  background: var(--surface);
  position: relative;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.sidebar-top {
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.sidebar-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.sidebar-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-2);
}

/* PROGRESS */
.sidebar-progress {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.prog-bar {
  flex: 1;
  height: 2px;
  background: var(--border2);
  border-radius: 2px;
  overflow: hidden;
}

.prog-fill {
  height: 100%;
  background: linear-gradient(90deg, #00c666, #00e87a);
  border-radius: 2px;
  transition: width 0.3s;
  box-shadow: 0 0 10px rgba(0, 232, 122, 0.3);
}

.prog-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  white-space: nowrap;
}

/* MODUL ACCORDION */
.modul { border-bottom: 1px solid var(--border); }

.modul-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  cursor: pointer;
  transition: background 0.1s;
  user-select: none;
}
.modul-header:hover { background: var(--surface2); }

.modul-arrow {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  transition: transform 0.2s;
  opacity: 0.4;
  color: var(--text);
}
.modul.open .modul-arrow { transform: rotate(90deg); }

.modul-num {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--text-3);
  width: 24px;
  flex-shrink: 0;
}

.modul-label { flex: 1; }

.modul-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}
.modul.done .modul-name { color: var(--text-2); }
.modul.active .modul-name { color: var(--text); }

.modul-info {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--text-3);
  margin-top: 1px;
}

.modul-status {
  font-family: var(--mono);
  font-size: 15px;
  flex-shrink: 0;
}
.modul-status.done { color: var(--accent); }
.modul-status.in-progress { color: var(--text-2); }
.modul-status.locked { color: var(--text-3); }

/* LEKCJE LISTA */
.lekcje-lista {
  display: none;
  background: var(--bg);
  padding: 4px 0;
}
.modul.open .lekcje-lista { display: block; }

.lekcja-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px 8px 36px;
  cursor: pointer;
  transition: background 0.1s;
  text-decoration: none;
}
.lekcja-row:hover { background: var(--surface); }
.lekcja-row.active { background: linear-gradient(90deg, var(--accent-bg), transparent); }

.lekcja-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-3);
  transition: all 0.2s;
}

.lekcja-row.done .lekcja-dot {
  width: 12px;
  height: 12px;
  border-radius: 0;
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300e87a' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  margin-left: -3px; /* centers the 12px icon where the 6px dot used to be */
  box-shadow: none !important;
}

.lekcja-row.active:not(.done) .lekcja-dot { 
  background: var(--accent); 
  box-shadow: 0 0 6px var(--accent); 
}

.lekcja-title {
  flex: 1;
  font-size: 17px;
  color: var(--text-2);
}
.lekcja-row.done .lekcja-title { color: var(--text-2); }
.lekcja-row.active .lekcja-title { color: var(--text); font-weight: 500; }

/* MAIN CONTENT */
.main {
  overflow-y: auto;
  background-color: var(--bg);
  background-image: linear-gradient(to right, rgba(0, 232, 122, 0.04) 1px, transparent 1px), linear-gradient(to bottom, rgba(0, 232, 122, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  display: flex;
  flex-direction: column;
}
.main::-webkit-scrollbar { width: 4px; }
.main::-webkit-scrollbar-track { background: transparent; }
.main::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* LEKCJA INFO */
.lekcja-info {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.lekcja-title-wrap {
  display: flex;
  align-items: center;
}

.lekcja-breadcrumb {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 6px;
}

.lekcja-heading {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  margin: 0;
}

.lekcja-action .swl-btn {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--bg);
  background: linear-gradient(135deg, #0ceb84, #00c666);
  border: none;
  padding: 8px 16px;
  border-radius: var(--r);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
  box-shadow: 0 4px 15px rgba(0, 232, 122, 0.2);
}

.lekcja-action .swl-btn.swl-btn-success {
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--border2);
}

.lekcja-action .swl-btn:hover {
  filter: brightness(1.1);
}

.content-area {
  padding: 24px;
  flex: 1;
}

.content-area h1, .content-area h2, .content-area h3 {
  color: var(--text);
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

.content-area a {
  color: var(--accent);
  text-decoration: none;
}
.content-area a:hover {
  text-decoration: underline;
}

.content-area p {
  margin-bottom: 1.25em;
  color: var(--text-2);
  line-height: 1.7;
}

.content-area ul, .content-area ol {
  margin-bottom: 1.25em;
  padding-left: 1.5em;
  color: var(--text-2);
}

.content-area ul {
  list-style-type: disc;
}

.content-area ol {
  list-style-type: decimal;
}

.content-area li {
  margin-bottom: 0.5em;
}

.content-area strong, .content-area b {
  color: var(--text);
  font-weight: 600;
}

.swl-video-wrapper {
  position: relative;
  width: 100%;
  max-width: calc(50vh * 1.7777);
  aspect-ratio: 16 / 9;
  height: auto;
  margin: 0 auto 24px auto;
  background: #000;
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}
.swl-video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.next-prev {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.np-col {
  flex: 1;
  display: flex;
}
.np-col-left { justify-content: flex-start; }
.np-col-center { justify-content: center; }
.np-col-right { justify-content: flex-end; }

.swl-complete-btn {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--bg);
  background: var(--accent);
  border: none;
  padding: 8px 16px;
  border-radius: var(--r);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}

.swl-complete-btn.swl-btn-success {
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--border2);
}

.swl-complete-btn:hover {
  filter: brightness(1.1);
}

.np-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1px solid var(--border2);
  border-radius: var(--r);
  background: none;
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
  text-decoration: none;
}
.np-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
}
.np-btn:hover { border-color: var(--accent); color: var(--text); }
.np-btn.primary {
  border-color: var(--accent);
  color: var(--accent);
  margin-left: auto;
}
.np-btn.primary:hover { background: var(--accent-bg); }

/* MOBILE MENU TOGGLE */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 8px;
  margin-right: 12px;
}

.mobile-menu-btn svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .app {
    display: flex;
    flex-direction: column;
  }
  .mobile-menu-btn {
    display: block;
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 300px;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.open {
    display: block;
  }
  .lekcja-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .lekcja-title-wrap {
    display: flex;
    align-items: center;
  }
  .np-btn, .swl-complete-btn {
    padding: 8px 8px;
    font-size: 10px;
  }
  .np-btn-text {
    display: none;
  }
  .np-btn svg {
    width: 16px;
    height: 16px;
  }
}
