/* ============================================
   ZVONALITIK ACADEMY - APP SHELL STYLES
   Layout: Left sidebar + Content + Right aside
   ============================================ */

/* === CSS Custom Properties === */
:root {
  --sidebar-width: 260px;
  --aside-width: 240px;
  --bottom-nav-height: 60px;
  --content-max-width: 800px;
  --nav-height: 64px;

  --anim-fast: 0.15s;
  --anim-normal: 0.3s;
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);

  --z-sidebar: 100;
  --z-overlay: 90;
  --z-bottom-nav: 100;
  --z-aside: 10;
}

/* ============================================
   APP SHELL - THREE COLUMN LAYOUT
   ============================================ */

.app-shell__container {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 100vw;
}

/* ============================================
   LEFT SIDEBAR - Lesson Navigation
   ============================================ */

.app-sidebar {
  position: fixed;
  top: var(--nav-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  z-index: var(--z-sidebar);
  display: flex;
  flex-direction: column;
  background: white;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  transition: transform var(--anim-normal) var(--ease-smooth);
}

.app-sidebar__header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}

.app-sidebar__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
}

.app-sidebar__logo i {
  width: 20px;
  height: 20px;
  color: var(--primary);
}

.app-sidebar__logo:hover {
  color: var(--primary);
}

/* Progress bar - hidden for minimal UI */
.app-sidebar__progress {
  display: none;
}

/* Sidebar Navigation */
.app-sidebar__nav {
  flex: 1;
  padding: 8px;
  overflow-y: auto;
}

/* Module Structure */
.app-sidebar__module {
  margin-bottom: 4px;
}

.app-sidebar__module-header {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  background: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: all var(--anim-fast);
}

.app-sidebar__module-header:hover {
  background: var(--bg-alt);
}

.app-sidebar__module--expanded .app-sidebar__module-header {
  background: var(--primary-light);
}

.app-sidebar__module-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  transition: transform var(--anim-fast);
}

.app-sidebar__module-icon i {
  width: 14px;
  height: 14px;
}

.app-sidebar__module--expanded .app-sidebar__module-icon {
  color: var(--primary);
}

.app-sidebar__module-title {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.app-sidebar__module--expanded .app-sidebar__module-title {
  color: var(--primary);
}

.app-sidebar__module-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-alt);
  padding: 2px 6px;
  border-radius: 10px;
}

.app-sidebar__module--expanded .app-sidebar__module-count {
  background: white;
  color: var(--primary);
}

/* Lessons List */
.app-sidebar__lessons {
  display: none;
  padding: 4px 0 8px 0;
}

.app-sidebar__module--expanded .app-sidebar__lessons {
  display: block;
}

.app-sidebar__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 8px 24px;
  margin-bottom: 1px;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 13px;
  transition: all var(--anim-fast);
}

.app-sidebar__item:hover {
  background: var(--bg-alt);
  color: var(--text-primary);
}

.app-sidebar__item--current {
  background: var(--primary);
  color: white;
}

.app-sidebar__item--current:hover {
  background: var(--primary);
  color: white;
}

.app-sidebar__lesson-number {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 24px;
}

.app-sidebar__item--current .app-sidebar__lesson-number {
  color: rgba(255, 255, 255, 0.7);
}

.app-sidebar__title {
  flex: 1;
  line-height: 1.3;
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */

.app-main {
  grid-column: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Lesson Navigation - Sticky at Bottom */
.app-shell .lesson-nav {
  position: sticky;
  bottom: 0;
  background: white;
  border-top: 1px solid var(--border);
  margin-top: auto;
  padding: 24px;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
}

/* ============================================
   RIGHT ASIDE - TOC & Lesson Info
   ============================================ */

.app-aside {
  position: fixed;
  top: 80px;
  right: 24px;
  width: var(--aside-width);
  z-index: var(--z-aside);
  padding: 0;
  overflow-y: auto;
  max-height: calc(100vh - 120px);
}

.app-aside__section {
  margin-bottom: 20px;
}

/* Hide non-TOC sections in aside */
/* Hide non-TOC sections in aside - REMOVED */
/* .app-aside__section:not(:first-child) {
  display: none;
} */

.app-aside__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.app-aside__title i {
  width: 14px;
  height: 14px;
}

/* Sticky TOC */
.app-aside__toc {
  position: sticky;
  top: 24px;
}

.app-aside__toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.app-aside__toc-item {
  margin-bottom: 8px;
}

.app-aside__toc-link {
  display: block;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 2px solid var(--border);
  transition: all var(--anim-fast);
  line-height: 1.4;
}

.app-aside__toc-link:hover {
  color: var(--text-primary);
  border-left-color: var(--text-muted);
}

.app-aside__toc-link--active {
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 500;
}

/* Lesson Meta and Progress in Aside - Hidden for minimal UI */
.app-aside__meta,
.app-aside__progress {
  display: none;
}

/* ============================================
   MOBILE BOTTOM NAVIGATION - FIXED
   ============================================ */

.app-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: white;
  border-top: 1px solid var(--border);
  z-index: var(--z-bottom-nav);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.app-bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  transition: color var(--anim-fast);
}

.app-bottom-nav__item:hover,
.app-bottom-nav__item--active {
  color: var(--primary);
}

.app-bottom-nav__item i {
  width: 22px;
  height: 22px;
}

/* ============================================
   SIDEBAR OVERLAY (Mobile)
   ============================================ */

.app-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: var(--z-overlay);
  opacity: 0;
  transition: opacity var(--anim-normal);
}

.app-sidebar-overlay--visible {
  display: block;
  opacity: 1;
}

/* ============================================
   RESPONSIVE - LARGE SCREENS (1280px+)
   ============================================ */

@media (min-width: 1280px) {
  .app-shell__container {
    grid-template-columns: var(--sidebar-width) 1fr;
  }

  .app-main {
    padding-right: calc(var(--aside-width) + 48px);
  }

  .app-aside {
    display: block;
  }
}

/* Hide aside on smaller screens */
@media (max-width: 1279px) {
  .app-aside {
    display: none;
  }
}

/* ============================================
   RESPONSIVE - MEDIUM SCREENS (1024px - 1279px)
   ============================================ */

@media (max-width: 1279px) {
  :root {
    --aside-width: 240px;
  }
}

/* ============================================
   RESPONSIVE - TABLET (768px - 1023px)
   ============================================ */

@media (max-width: 1023px) {
  .app-shell__container {
    grid-template-columns: 1fr;
  }

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

  .app-main {
    grid-column: 1;
    padding-left: 0;
  }

  .app-aside {
    display: none;
  }

  .app-shell--sidebar-open .app-sidebar {
    transform: translateX(0);
  }

  .app-shell--sidebar-open .app-sidebar-overlay {
    display: block;
    opacity: 1;
  }
}

/* ============================================
   RESPONSIVE - MOBILE (< 768px)
   ============================================ */

@media (max-width: 767px) {
  :root {
    --bottom-nav-height: 56px;
  }

  .app-bottom-nav {
    display: flex;
  }

  .app-main {
    padding-bottom: var(--bottom-nav-height);
  }

  .app-sidebar {
    width: 280px;
  }
}

/* ============================================
   BODY STATE CLASSES
   ============================================ */

body.app-shell--sidebar-open {
  overflow: hidden;
}
