/* Shared navigation: identical icons, spacing and active state on every learning page. */
.learning-sidebar,.learning-mobile-nav{box-sizing:border-box;font-family:Nunito,"Segoe UI",sans-serif}
.learning-sidebar *,.learning-mobile-nav *{box-sizing:border-box}
.learning-sidebar{position:fixed;inset:0 auto 0 0;width:256px;height:100dvh;display:flex;flex-direction:column;justify-content:space-between;gap:24px;padding:16px;background:#fff;border-right:1px solid #e2e8f0;z-index:40;overflow-y:auto;color:#475569}
.learning-brand{display:flex;align-items:center;gap:10px;padding:12px 0;margin-bottom:24px;text-decoration:none;color:#1e293b}
.learning-brand-icon{display:grid;place-items:center;width:40px;height:44px;flex-shrink:0;background:transparent;border-radius:0;font-size:24px;box-shadow:none}
.learning-brand-icon img{
  transform-origin:50% 60%;
  animation:tobiBrandFloat 2.8s ease-in-out infinite;
  will-change:transform;
}
.learning-brand:hover .learning-brand-icon img{
  transform:translateY(-1px) rotate(0deg) scale(1.05);
}
@keyframes tobiBrandFloat{
  0%,100%{transform:translateY(0) rotate(0deg)}
  25%{transform:translateY(-2px) rotate(-1deg)}
  50%{transform:translateY(-3px) rotate(1deg)}
  75%{transform:translateY(-1px) rotate(-.5deg)}
}
@media (prefers-reduced-motion: reduce){
  .learning-brand-icon img{animation:none!important;transform:none!important}
}

.learning-brand-title{display:block;font-size:14px;line-height:1.3;font-weight:900;white-space:nowrap}
.learning-brand-subtitle{display:block;margin-top:3px;font-size:10px;line-height:1.5;font-weight:600;color:#94a3b8}
.learning-sidebar-nav{display:flex;flex-direction:column;gap:4px}
.learning-nav-link{display:flex;align-items:center;gap:12px;min-height:48px;padding:12px 14px;border-radius:16px;color:#475569;text-decoration:none;font-size:14px;line-height:1.5;font-weight:800;transition:background-color .15s,color .15s}
.learning-nav-link:hover{background:#ecfdf5;color:#047857}
.learning-nav-link[aria-current="page"]{background:#10b981;color:#fff;box-shadow:0 2px 4px #a7f3d080;font-weight:900}
.learning-nav-icon{display:inline-flex;align-items:center;justify-content:center;width:22px;height:24px;flex-shrink:0;font-size:20px;line-height:1}
.learning-nav-icon svg{display:block;width:20px;height:20px}
.learning-nav-label-short{display:none}
.learning-nav-label-full{display:inline}
.learning-brand:focus-visible,.learning-nav-link:focus-visible{outline:3px solid #047857;outline-offset:3px}
.learning-curriculum{padding:12px;background:#f8fafc;border:1px solid #e2e8f0;border-radius:16px}
.learning-curriculum p{margin:0 0 4px;font-size:12px;line-height:1.5;font-weight:800;color:#047857}
.learning-curriculum small{display:block;font-size:11px;line-height:1.5;font-weight:600;color:#64748b}
.learning-mobile-nav{display:none}
@media(min-width:1024px){.learning-page-content{padding-left:256px!important}.learning-page-header{left:256px!important}.learning-home-layout{padding-left:256px}}
@media(max-width:1023px){.learning-sidebar{display:none}.learning-mobile-nav{position:fixed;inset:auto 0 0;display:flex;align-items:center;justify-content:space-around;padding:4px 4px calc(4px + env(safe-area-inset-bottom));min-height:64px;background:#fffffff5;border-top:1px solid #e2e8f0;box-shadow:0 -2px 8px #0000000f;z-index:50}.learning-mobile-nav .learning-nav-link{flex:1;min-width:0;flex-direction:column;justify-content:center;gap:3px;padding:5px 2px;min-height:54px;border-radius:12px;font-size:10px;line-height:1.4}.learning-home-layout{padding-bottom:calc(80px + env(safe-area-inset-bottom))}}
@media(prefers-reduced-motion:reduce){.learning-nav-link{transition:none}}


/* ============================================================
   PC TOP NAVIGATION
   Chỉ áp dụng desktop có chuột/trackpad.
   Tự co giãn theo chiều rộng cửa sổ, không cho menu đè lên hồ sơ.
   Mobile/tablet giữ nguyên hoàn toàn.
   ============================================================ */
@media (min-width:1200px), (min-width:768px){
  :root{
    --learning-pc-topbar-height:66px;
    --learning-pc-account-width:clamp(560px,36vw,620px);
  }

  /* Vùng trái: brand + 5 mục menu. Bị giới hạn cứng trước vùng hồ sơ. */
  .learning-sidebar{
    inset:0 var(--learning-pc-account-width) auto 0;
    width:auto;
    height:var(--learning-pc-topbar-height);
    min-height:var(--learning-pc-topbar-height);
    padding:6px 14px 6px 18px;
    display:flex;
    flex-direction:row;
    align-items:center;
    justify-content:flex-start;
    gap:10px;
    overflow:hidden;
    background:#fff;
    border-right:0;
    border-bottom:1px solid #e2e8f0;
    box-shadow:0 1px 8px rgba(15,23,42,.04);
    z-index:44;
  }

  .learning-sidebar>div:first-child{
    min-width:0;
    width:100%;
    display:flex;
    align-items:center;
    gap:14px;
    overflow:hidden;
  }

  .learning-brand{
    flex:0 0 auto;
    min-width:0;
    margin:0;
    padding:0;
    gap:8px;
  }

  .learning-brand-icon{
    width:32px;
    height:36px;
  }

  .learning-brand-title{
    font-size:13px;
    line-height:1.15;
  }

  .learning-brand-subtitle{
    display:none;
  }

  .learning-sidebar-nav{
    min-width:0;
    flex:1 1 auto;
    display:flex;
    flex-direction:row;
    align-items:center;
    justify-content:center;
    gap:4px;
    white-space:nowrap;
    overflow:hidden;
  }

  .learning-sidebar .learning-nav-link{
    min-width:0;
    flex:0 1 auto;
    min-height:38px;
    padding:8px 10px;
    gap:6px;
    border:1px solid transparent;
    border-radius:10px;
    font-size:14px;
    line-height:1.15;
    font-weight:900;
    white-space:nowrap;
    overflow:hidden;
    transition:background-color .18s ease,color .18s ease,border-color .18s ease,box-shadow .18s ease,transform .18s ease;
  }

  .learning-sidebar .learning-nav-link:hover{
    background:#dff8ee;
    color:#047857;
    border-color:#a7f3d0;
    box-shadow:0 7px 16px rgba(16,185,129,.18);
    transform:translateY(-2px);
  }

  .learning-sidebar .learning-nav-link[aria-current="page"]{
    border-radius:10px;
  }

  .learning-sidebar .learning-nav-link[aria-current="page"]:hover{
    background:#059669;
    color:#fff;
    border-color:#059669;
    box-shadow:0 8px 18px rgba(5,150,105,.24);
  }

  .learning-sidebar .learning-nav-icon{
    transition:transform .18s ease,filter .18s ease;
  }

  .learning-sidebar .learning-nav-link:hover .learning-nav-icon{
    transform:scale(1.13);
    filter:saturate(1.18);
  }

  .learning-sidebar .learning-nav-link>span:last-child{
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
  }

  .learning-sidebar .learning-nav-icon{
    width:18px;
    height:20px;
    flex:0 0 auto;
    font-size:17px;
  }

  .learning-sidebar .learning-nav-icon svg{
    width:17px;
    height:17px;
  }

  .learning-curriculum{
    display:none;
  }

  /* Vùng phải: hồ sơ + streak + sao + tài khoản. */
  .learning-page-header,
  .map-auth-header{
    position:fixed!important;
    top:0!important;
    right:0!important;
    left:auto!important;
    width:var(--learning-pc-account-width)!important;
    height:var(--learning-pc-topbar-height)!important;
    min-height:var(--learning-pc-topbar-height)!important;
    padding:6px 16px!important;
    margin:0!important;
    display:flex!important;
    align-items:center!important;
    justify-content:flex-end!important;
    gap:8px!important;
    background:#fff!important;
    border-bottom:1px solid #e2e8f0;
    box-shadow:0 1px 8px rgba(15,23,42,.04)!important;
    backdrop-filter:none!important;
    overflow:visible!important;
    z-index:45!important;
  }

  .learning-page-header .mobile-shared-brand,
  .map-auth-header .mobile-map-brand{
    display:none!important;
  }

  .learning-page-header .header-learning-summary,
  .map-auth-header .map-header-profile-row{
    min-width:0;
    flex:1 1 auto;
    display:flex;
    align-items:center;
    justify-content:flex-end;
    gap:7px!important;
    overflow:visible!important;
  }

  .learning-page-header #header-profile-badge,
  .map-auth-header #header-profile-badge{
    min-width:0;
    max-width:260px;
    flex:1 1 220px;
    overflow:visible!important;
    position:relative;
    z-index:70;
  }

  .learning-page-header #profile-switcher-wrapper,
  .map-auth-header #profile-switcher-wrapper{
    min-width:0;
    max-width:100%;
    position:relative;
    z-index:70;
  }

  .learning-page-header #btn-toggle-profile-menu,
  .map-auth-header #btn-toggle-profile-menu{
    min-width:0!important;
    max-width:100%!important;
    overflow:hidden!important;
  }

  .learning-page-header #btn-toggle-profile-menu>span:nth-child(2),
  .map-auth-header #btn-toggle-profile-menu>span:nth-child(2){
    min-width:0;
    max-width:90px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    flex:0 1 auto;
  }

  .learning-page-header #btn-toggle-profile-menu>span:nth-child(3),
  .map-auth-header #btn-toggle-profile-menu>span:nth-child(3){
    min-width:0;
    max-width:115px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    flex:0 1 auto;
  }

  /* Dropdown phải nổi đầy đủ, không bị cắt theo chiều rộng của nút hồ sơ. */
  .learning-page-header #profile-switcher-dropdown,
  .map-auth-header #profile-switcher-dropdown{
    width:320px!important;
    max-width:min(320px,calc(100vw - 24px))!important;
    z-index:120!important;
    overflow:visible!important;
  }

  .learning-page-header .header-learning-stats{
    display:flex;
    align-items:center;
    gap:6px!important;
    flex:0 0 auto;
  }

  .learning-page-header .header-learning-stats>div,
  .map-auth-header .map-header-profile-row>div:not(#header-profile-badge){
    flex:0 0 auto;
  }

  .learning-page-header .page-login,
  .map-auth-header .page-login{
    flex:0 0 auto;
    padding-left:12px!important;
    padding-right:12px!important;
  }

  /* Gỡ offset sidebar cũ để nội dung PC trải hết chiều ngang. */
  .learning-page-content{
    padding-left:0!important;
  }

  .learning-page-header{
    left:auto!important;
  }

  .learning-home-layout{
    padding-left:0!important;
  }

  .home-main{
    padding-top:calc(var(--learning-pc-topbar-height) + 12px)!important;
  }

  .learning-page-content>main{
    padding-top:calc(var(--learning-pc-topbar-height) + 12px)!important;
  }

  .learning-page-content>main>div.max-w-7xl,
  .learning-page-content>main>div.max-w-6xl{
    max-width:none!important;
    width:100%!important;
  }
}

/* PC dưới Full HD dùng nhãn ngắn; Full HD trở lên dùng nhãn đầy đủ. */
@media (min-width:1200px) and (max-width:1919px){
  .learning-sidebar .learning-nav-label-full{
    display:none!important;
  }

  .learning-sidebar .learning-nav-label-short{
    display:inline!important;
  }
}

@media (min-width:1920px) and (hover:hover) and (pointer:fine){
  .learning-sidebar .learning-nav-label-full{
    display:inline!important;
  }

  .learning-sidebar .learning-nav-label-short{
    display:none!important;
  }
}

/* PC trung bình: ưu tiên hồ sơ + menu, thu gọn thông tin phụ. */
@media (min-width:1400px) and (max-width:1599px){
  :root{
    --learning-pc-account-width:520px;
  }

  .learning-sidebar{
    padding-left:14px;
    padding-right:10px;
  }

  .learning-sidebar>div:first-child{
    gap:10px;
  }

  .learning-sidebar .learning-nav-link{
    padding:7px 7px;
    gap:4px;
    font-size:13.5px;
  }

  .learning-page-header,
  .map-auth-header{
    padding-left:10px!important;
    padding-right:10px!important;
    gap:6px!important;
  }

  .learning-page-header #header-profile-badge,
  .map-auth-header #header-profile-badge{
    max-width:185px;
    flex-basis:165px;
  }

  .learning-page-header #btn-toggle-profile-menu>span:nth-child(3),
  .map-auth-header #btn-toggle-profile-menu>span:nth-child(3){
    display:none!important;
  }

  .learning-page-header .page-login,
  .map-auth-header .page-login{
    padding-left:10px!important;
    padding-right:10px!important;
    font-size:11px!important;
  }
}

/* PC hẹp: co mạnh nhưng vẫn giữ tên bé + khả năng đổi hồ sơ. */
@media (min-width:1200px) and (max-width:1399px){
  :root{
    --learning-pc-account-width:460px;
  }

  .learning-sidebar{
    padding-left:10px;
    padding-right:6px;
  }

  .learning-sidebar>div:first-child{
    gap:6px;
  }

  .learning-brand{
    gap:0;
  }

  .learning-brand>span:last-child{
    display:none;
  }

  .learning-brand-icon{
    width:34px;
    height:38px;
  }

  .learning-sidebar .learning-nav-link{
    padding:7px 6px;
    gap:4px;
    font-size:13px;
  }


  .learning-sidebar .learning-nav-icon{
    width:15px;
    font-size:15px;
  }

  .learning-sidebar .learning-nav-icon svg{
    width:15px;
    height:15px;
  }

  .learning-page-header,
  .map-auth-header{
    padding-left:8px!important;
    padding-right:8px!important;
    gap:5px!important;
  }

  .learning-page-header .header-learning-summary,
  .map-auth-header .map-header-profile-row{
    gap:4px!important;
  }

  .learning-page-header #header-profile-badge,
  .map-auth-header #header-profile-badge{
    max-width:145px;
    flex-basis:135px;
  }

  .learning-page-header #btn-toggle-profile-menu,
  .map-auth-header #btn-toggle-profile-menu{
    padding-left:8px!important;
    padding-right:7px!important;
    gap:5px!important;
  }

  .learning-page-header #btn-toggle-profile-menu>span:nth-child(2),
  .map-auth-header #btn-toggle-profile-menu>span:nth-child(2){
    max-width:66px;
  }

  .learning-page-header #btn-toggle-profile-menu>span:nth-child(3),
  .map-auth-header #btn-toggle-profile-menu>span:nth-child(3){
    display:none!important;
  }

  .learning-page-header .header-learning-stats,
  .map-auth-header .map-header-profile-row{
    gap:4px!important;
  }

  .learning-page-header .header-learning-stats>div,
  .map-auth-header .map-header-profile-row>div:not(#header-profile-badge){
    padding-left:8px!important;
    padding-right:8px!important;
  }

  .learning-page-header .page-login,
  .map-auth-header .page-login{
    max-width:108px;
    padding-left:8px!important;
    padding-right:8px!important;
    font-size:10px!important;
    overflow:hidden;
  }

  .learning-page-header .page-login .nav-auth-text,
  .map-auth-header .page-login .nav-auth-text{
    min-width:0;
    max-width:76px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
  }
}


/* ============================================================
   PC 1280x720 TUNING
   Chỉ tinh chỉnh viewport gần 1280x720; các PC khác giữ nguyên.
   ============================================================ */
@media (min-width:1260px) and (max-width:1300px) and (min-height:680px) and (max-height:760px){
  :root{
    --learning-pc-account-width:440px;
  }

  /* Cân lại vùng brand + menu ở 1280px. */
  .learning-sidebar{
    padding-left:12px;
    padding-right:8px;
  }

  .learning-sidebar>div:first-child{
    gap:8px;
  }

  .learning-brand{
    gap:6px;
  }

  .learning-brand>span:last-child{
    display:block!important;
  }

  .learning-brand-title{
    display:block;
    max-width:116px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    font-size:11.5px;
    line-height:1.2;
  }

  .learning-brand-subtitle{
    display:none!important;
  }

  .learning-brand-icon{
    width:32px;
    height:36px;
  }

  .learning-sidebar-nav{
    justify-content:flex-start;
    gap:2px;
  }

  .learning-sidebar .learning-nav-link{
    padding:7px 6px;
    gap:4px;
    font-size:13px;
  }

  .learning-sidebar .learning-nav-icon{
    width:14px;
    font-size:14px;
  }

  .learning-sidebar .learning-nav-icon svg{
    width:14px;
    height:14px;
  }

  /* Vùng hồ sơ: đủ chỗ cho tên bé + 2 chỉ số + nút Hồ Sơ Của Tôi. */
  .learning-page-header,
  .map-auth-header{
    padding-left:7px!important;
    padding-right:10px!important;
    gap:5px!important;
  }

  .learning-page-header .header-learning-summary,
  .map-auth-header .map-header-profile-row{
    gap:4px!important;
  }

  .learning-page-header #header-profile-badge,
  .map-auth-header #header-profile-badge{
    max-width:138px;
    flex:0 1 138px;
  }

  .learning-page-header #btn-toggle-profile-menu,
  .map-auth-header #btn-toggle-profile-menu{
    padding-left:8px!important;
    padding-right:6px!important;
    gap:4px!important;
  }

  .learning-page-header #btn-toggle-profile-menu>span:nth-child(2),
  .map-auth-header #btn-toggle-profile-menu>span:nth-child(2){
    max-width:72px;
  }

  .learning-page-header #btn-toggle-profile-menu>span:nth-child(3),
  .map-auth-header #btn-toggle-profile-menu>span:nth-child(3){
    display:none!important;
  }

  .learning-page-header .header-learning-stats>div,
  .map-auth-header .map-header-profile-row>div:not(#header-profile-badge){
    padding-left:7px!important;
    padding-right:7px!important;
  }

  .learning-page-header .page-login,
  .map-auth-header .page-login{
    max-width:none!important;
    min-width:112px;
    padding-left:10px!important;
    padding-right:10px!important;
    font-size:10px!important;
    overflow:visible!important;
  }

  .learning-page-header .page-login .nav-auth-text,
  .map-auth-header .page-login .nav-auth-text{
    max-width:none!important;
    overflow:visible!important;
    text-overflow:clip!important;
    white-space:nowrap!important;
  }
}

/* UI_PREVIEW_BRANCH_TRIGGER: harmless marker for preview workflow */

/* Keep desktop navigation at the top when its window is narrower than 1200px. */
@media(min-width:768px) and (max-width:1199px) and (hover:hover) and (pointer:fine){
:root{--learning-pc-account-width:350px}
.learning-sidebar{padding:6px 8px;gap:6px}
.learning-sidebar>div:first-child{gap:6px}
.learning-sidebar-nav{gap:2px;justify-content:flex-start}
.learning-sidebar .learning-nav-link{padding:8px 5px;gap:3px;font-size:11px;flex:0 0 auto}
.learning-sidebar .learning-nav-label-full{display:none}
.learning-sidebar .learning-nav-label-short{display:inline}
.learning-sidebar .learning-nav-icon{width:16px;font-size:16px}
.learning-sidebar .learning-nav-icon svg{width:16px;height:16px}
.learning-brand-title{font-size:11px}
.learning-brand-icon{width:28px;height:32px}
.learning-mobile-nav{display:none!important}
.learning-page-content,.learning-home-layout{padding-left:0!important}
}
@media(min-width:768px) and (max-width:999px) and (hover:hover) and (pointer:fine){
:root{--learning-pc-account-width:320px}
.learning-brand>span:last-child{display:none!important}
.learning-sidebar .learning-nav-link{padding-left:4px;padding-right:4px;font-size:10px}
}

@media(width:1032px) and (orientation:portrait){
.learning-sidebar{position:fixed!important;inset:0 auto 0 0!important;width:210px!important;height:100dvh!important;min-height:100dvh!important;display:flex!important;flex-direction:column!important;align-items:stretch!important;justify-content:space-between!important;padding:14px 12px!important;overflow-y:auto!important}
.learning-sidebar>div:first-child{display:block!important;width:100%!important;overflow:visible!important}
.learning-sidebar .learning-brand{margin-bottom:16px!important;padding:8px 0!important}
.learning-sidebar .learning-brand>span:last-child{display:block!important}
.learning-sidebar-nav{display:flex!important;flex-direction:column!important;align-items:stretch!important;gap:4px!important;overflow:visible!important}
.learning-sidebar .learning-nav-link{min-height:44px!important;padding:10px!important;gap:9px!important;font-size:12.5px!important;flex:0 0 auto!important;white-space:normal!important}
.learning-sidebar .learning-nav-label-full{display:inline!important}.learning-sidebar .learning-nav-label-short{display:none!important}
.learning-curriculum{display:block!important}
.learning-page-content,.learning-home-layout{padding-left:210px!important}
.learning-page-header,.map-auth-header{left:210px!important;right:0!important;width:auto!important;height:72px!important;min-height:72px!important;padding:10px 18px!important}
.learning-mobile-nav{display:none!important}
}
