/* Hangeul Path — Shared Shell Styles (Sidebar, Mobile Bottom Nav, Mobile Top Bar) */
/* Used on every app screen: /dashboard/, /roadmap/, /lessons/, /hangul/, /review/, etc. */

/* Universal Base Reset for Shell Layout */
*, *::before, *::after {
  box-sizing: border-box;
}

/* Prevent layout shift between pages with and without vertical scrollbars */
html {
  scrollbar-gutter: stable;
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  padding: 0;
  background: #F7F3EC;
  color: #14213D;
  font-family: Manrope, 'Noto Sans KR', sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Desktop Sticky Sidebar (Left Column) */
.side-aside-1,
.side-aside-1 *,
.side-aside-1 *::before,
.side-aside-1 *::after {
  box-sizing: border-box !important;
}

.side-aside-1 {
  width: 280px !important;
  min-width: 280px !important;
  max-width: 280px !important;
  flex: 0 0 280px !important;
  box-sizing: border-box !important;
  padding: 28px 20px !important;
  border-right: 1.5px solid #E2DACB !important;
  background: #FBF8F2 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 28px !important;
  position: sticky !important;
  top: 0 !important;
  height: 100vh !important;
  overflow-y: auto !important;
  scrollbar-width: none !important;       /* Firefox */
  -ms-overflow-style: none !important;    /* IE / Edge */
  z-index: 30 !important;
  font-family: Manrope, 'Noto Sans KR', sans-serif !important;
}
.side-aside-1::-webkit-scrollbar {
  display: none !important;               /* Chrome / Safari / Opera */
}

.side-link-1 {
  width: 100% !important;
  box-sizing: border-box !important;
  min-height: 46px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 14px;
  background: #14213D !important;
  color: #F7F3EC !important;
  font-weight: 800;
  font-size: 15px;
  text-decoration: none !important;
  font-family: Manrope, 'Noto Sans KR', sans-serif !important;
  transition: transform 0.12s cubic-bezier(0.33, 1, 0.68, 1), background 0.15s ease, color 0.15s ease !important;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.side-link-1:active {
  transform: scale(0.97) !important;
}

.side-link-2 {
  width: 100% !important;
  box-sizing: border-box !important;
  min-height: 46px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 14px;
  color: #14213D !important;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none !important;
  font-family: Manrope, 'Noto Sans KR', sans-serif !important;
  transition: transform 0.12s cubic-bezier(0.33, 1, 0.68, 1), background 0.15s ease, color 0.15s ease !important;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.side-link-2:hover {
  background: #EFE8DA !important;
  color: #14213D !important;
}
.side-link-2:active {
  transform: scale(0.97) !important;
}

.side-link-3 {
  width: 100% !important;
  box-sizing: border-box !important;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.02em;
  padding: 0 8px;
  color: #14213D !important;
  text-decoration: none !important;
  font-family: Manrope, 'Noto Sans KR', sans-serif !important;
}
.side-link-3:hover {
  color: #14213D !important;
}

.side-text-1 {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #14213D;
  color: #F7F3EC;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Noto Serif KR", serif;
  font-weight: 900;
  font-size: 22px;
}

.side-text-2 {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #C8421C;
  border: 2px solid #FBF8F2;
  box-sizing: border-box;
}

.side-nav-1 {
  width: 100% !important;
  box-sizing: border-box !important;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 600;
  font-size: 15px;
}

.side-box-1 {
  width: 100% !important;
  box-sizing: border-box !important;
  margin-top: auto;
  padding: 16px;
  border-radius: 20px;
  background: #14213D;
  color: #F7F3EC;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.side-text-3 {
  font-size: 13px;
  font-weight: 700;
  opacity: 0.7;
}

.side-text-4 {
  font-size: 17px;
  font-weight: 800;
}

.side-link-4 {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #C8421C !important;
  color: #FFFFFF !important;
  border-radius: 999px;
  font-weight: 800;
  font-size: 14px;
  text-decoration: none !important;
}
.side-link-4:hover {
  background: #B53816 !important;
  color: #FFFFFF !important;
}

.side-text-5 {
  margin-left: auto;
  padding: 2px 9px;
  border-radius: 999px;
  background: #C8421C;
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 800;
}

/* Mobile Top Bar & Drawer Controls */
.hp-bar {
  display: none;
}
.hp-chk {
  display: none;
}
.hp-scrim {
  display: none;
}

/* Mobile Bottom Navigation (5 tabs) */
.hp-bottom-nav {
  display: none;
}

.tab-box-1 {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: #FBF8F2;
  border-top: 1.5px solid #E2DACB;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-sizing: border-box;
}

.tab-nav-1 {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 64px;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 8px;
  box-sizing: border-box;
}

.tab-link-1 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 800;
  color: #C8421C;
  text-decoration: none;
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  white-space: nowrap;
  line-height: 1.2;
  transition: transform 0.12s cubic-bezier(0.33, 1, 0.68, 1), color 0.15s ease !important;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.tab-link-1:active {
  transform: scale(0.90) !important;
}

.tab-link-2 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #5C6479;
  text-decoration: none;
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  white-space: nowrap;
  line-height: 1.2;
  transition: transform 0.12s cubic-bezier(0.33, 1, 0.68, 1), color 0.15s ease !important;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.tab-link-2:active {
  transform: scale(0.90) !important;
}

.tab-text-1 {
  position: absolute;
  top: -2px;
  right: calc(50% - 16px);
  padding: 1px 6px;
  border-radius: 999px;
  background: #C8421C;
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 800;
}

@media (min-width: 901px) {
  .hp-desk {
    display: flex !important;
    width: 100% !important;
    min-height: 100vh !important;
    align-items: stretch !important;
  }
  .hp-desk > div,
  .hp-desk > .box-1,
  .box-1:has(.side-aside-1) {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    width: 100% !important;
    min-height: 100vh !important;
  }
  .box-1:has(.side-aside-1) > .hp-desk {
    flex: 1 1 0% !important;
    width: auto !important;
    min-width: 0 !important;
  }
}

/* Breakpoint 900px — Mobile Adaptation */
@media (max-width: 900px) {
  html:has(#hpm:checked),
  body:has(#hpm:checked),
  body.hp-drawer-open {
    overflow: hidden !important;
  }
  /* The page wrapper is an inline display:flex row; let the 100%-wide top bar
     take its own line so main content gets the full width below it. */
  .hp-desk {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
  .hp-desk > .box-1,
  .hp-desk > div,
  .box-1 {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: wrap !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100vw !important;
  }
  .hp-desk .hp-main,
  .hp-main {
    flex: 1 1 100% !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding: 16px 16px calc(88px + env(safe-area-inset-bottom, 0px)) !important;
  }
  .side-aside-1 {
    display: flex !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    height: 100vh !important;
    height: 100dvh !important;
    width: min(290px, 86vw) !important;
    max-width: 86vw !important;
    z-index: 100 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    box-shadow: 12px 0 36px rgba(20, 33, 61, 0.22) !important;
    background: #FBF8F2 !important;
    border-right: 1.5px solid #E2DACB !important;
    padding: calc(20px + env(safe-area-inset-top, 0px)) 18px calc(36px + env(safe-area-inset-bottom, 0px)) !important;
    box-sizing: border-box !important;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.33, 1, 0.68, 1), visibility 0.28s;
    visibility: hidden;
    pointer-events: none;
  }
  .hp-chk:checked ~ .side-aside-1,
  .hp-chk:checked ~ .hp-side,
  .hp-chk:checked ~ * .side-aside-1,
  .hp-chk:checked ~ * .hp-side {
    transform: translateX(0) !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }
  .hp-bar {
    display: flex;
    flex: 0 0 auto;
    width: 100%;
    box-sizing: border-box;
    min-height: 60px;
    padding: env(safe-area-inset-top, 0px) 12px 0 16px;
    align-items: center;
    justify-content: space-between;
    background: #FBF8F2;
    border-bottom: 1.5px solid #E2DACB;
    position: sticky;
    top: 0;
    z-index: 40;
  }
  .hp-scrim {
    display: block !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 90 !important;
    background: rgba(20, 33, 61, 0.45) !important;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease-out;
  }
  .hp-chk:checked ~ .hp-scrim,
  .hp-chk:checked ~ * .hp-scrim {
    opacity: 1 !important;
    pointer-events: auto !important;
  }
  .hp-bottom-nav {
    display: flex !important;
  }
}

@media (max-width: 480px) {
  .hp-main > * {
    min-width: 0;
  }
  .hp-main h1,
  .hp-main h2,
  .hp-main h3 {
    overflow-wrap: anywhere;
  }
  .hp-main p,
  .hp-main td,
  .hp-main th,
  .hp-main li {
    overflow-wrap: break-word;
  }
  .hp-main table:not(.lh-book-table) {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 360px) {
  .hp-main,
  .hp-desk .hp-main {
    padding: 12px 10px calc(84px + env(safe-area-inset-bottom, 0px)) !important;
  }
  .hp-bar {
    padding-left: 10px;
    padding-right: 10px;
    gap: 6px;
  }
  .tab-nav-1 {
    height: 60px;
    padding: 0 2px;
  }
  .tab-link-1,
  .tab-link-2 {
    font-size: 10px;
    gap: 2px;
    padding: 4px 2px;
    min-width: 0;
  }
  .tab-link-1 svg,
  .tab-link-2 svg {
    width: 20px;
    height: 20px;
  }
}

/* ========================================================================= */
/* Бөлүмдөрдү алмаштыруу жана басуу анимациялары (Transitions & Feedback)     */
/* ========================================================================= */
@keyframes hpPageEnter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hp-main {
  animation: hpPageEnter 0.22s cubic-bezier(0.33, 1, 0.68, 1) backwards;
}

/* Баскычтарды жана карталарды баскандагы активдүү анимация */
.box-8, .section-1, .link-1, .link-2, .link-3, .link-4, .btn-1, .btn-2, .btn-3, .btn-4, .btn-5, .choice-btn, .opt-btn {
  transition: transform 0.12s cubic-bezier(0.33, 1, 0.68, 1), box-shadow 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.box-8:active, .link-1:active, .link-2:active, .link-3:active, .link-4:active, .btn-1:active, .btn-2:active, .btn-3:active, .choice-btn:active {
  transform: scale(0.97) !important;
}

/* ========================================================================= */
/* Admin Panel Sidebar & Layout Styles (Ported from layout.css)              */
/* ========================================================================= */
.adm-aside-1 {
  flex: 0 0 250px;
  box-sizing: border-box;
  padding: 28px 18px;
  background: #FBF8F2;
  border-right: 1.5px solid #E2DACB;
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: none;
}
.adm-aside-1::-webkit-scrollbar { display: none; }
.adm-box-1 { display: flex; align-items: center; gap: 12px; padding: 0 6px; }
.adm-text-1 { position: relative; width: 40px; height: 40px; border-radius: 12px; background: #14213D; color: #F7F3EC; display: flex; align-items: center; justify-content: center; font-family: "Noto Serif KR", serif; font-weight: 900; font-size: 22px; flex-shrink: 0; }
.adm-text-2 { position: absolute; top: -3px; right: -3px; width: 10px; height: 10px; border-radius: 50%; background: #D8502A; border: 2px solid #FBF8F2; box-sizing: border-box; }
.adm-box-2 { font-weight: 800; font-size: 17px; letter-spacing: -0.02em; }
.adm-box-3 { font-size: 11px; font-weight: 800; letter-spacing: 0.14em; color: #C8421C; }
.adm-nav-1 { display: flex; flex-direction: column; gap: 4px; }
.adm-link-1 { min-height: 42px; padding: 0 14px; display: flex; align-items: center; gap: 12px; border-radius: 14px; font-weight: 800; font-size: 15px; background: #14213D; color: #F7F3EC; text-decoration: none; }
.adm-link-2 { min-height: 42px; padding: 0 14px; display: flex; align-items: center; gap: 12px; border-radius: 14px; font-weight: 600; font-size: 15px; background: transparent; color: #14213D; text-decoration: none; transition: background .15s ease; }
.adm-link-2:hover { background: #EFE8DA; }
.adm-link-3 { margin-top: auto; min-height: 44px; display: flex; align-items: center; justify-content: center; border: 2px solid #E2DACB; border-radius: 999px; font-weight: 700; font-size: 14px; text-decoration: none; color: #14213D; }
.adm-link-3:hover { background: #EFE8DA; }
