/* Quy cách app điện thoại TOEX (11/11/2026) – xem design/QUY-CACH-APP-DIEN-THOAI.md
   Dùng chung cho Góc học tập, /quan-ly, /giao-vien. Tệp này chỉ thêm hành vi điện thoại, không đổi màu / kiểu chữ của trang. */

/* ---------- dải mất mạng ---------- */
.qc-mang { position: fixed; left: 50%; top: calc(10px + env(safe-area-inset-top, 0px)); z-index: 2147483000; transform: translate(-50%, -160%);
  display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 24px); padding: 9px 16px; border-radius: 999px;
  background: #1F2A35; color: #fff; font: 600 14px/1.35 "Be Vietnam Pro", system-ui, sans-serif; box-shadow: 0 8px 24px rgba(20, 32, 44, .25);
  transition: transform .26s cubic-bezier(.23, 1, .32, 1); pointer-events: none; }
.qc-mang.hien { transform: translate(-50%, 0); }
.qc-mang.lai { background: #2F5D3A; }
.qc-mang::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #F07A3C; flex: none; }
.qc-mang.lai::before { background: #9BE0A6; }

/* ---------- bảng trượt từ dưới (điện thoại) ---------- */
@keyframes qc-len { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes qc-mo-nen { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 700px) {
  .qc-sheet { position: fixed !important; left: 0 !important; right: 0 !important; bottom: 0 !important; top: auto !important;
    width: auto !important; max-width: none !important; min-width: 0 !important; margin: 0 !important; max-height: 92dvh !important;
    border-radius: 18px 18px 0 0 !important; border-bottom-width: 0 !important; overflow-y: auto !important; overscroll-behavior: contain;
    animation: qc-len .3s cubic-bezier(.23, 1, .32, 1); }
  .qc-sheet::after { content: ""; display: block; flex: none; height: env(safe-area-inset-bottom, 0px); }
  .qc-sheet.qc-keo-dang { transition: none !important; animation: none !important; }
  .qc-sheet.qc-tha { transition: transform .22s cubic-bezier(.23, 1, .32, 1) !important; }
  .qc-keo { position: absolute; top: 0; left: 50%; z-index: 5; width: 96px; height: 22px; margin-left: -48px; touch-action: none; cursor: grab; }
  .qc-keo::before { content: ""; position: absolute; left: 30px; right: 30px; top: 7px; height: 5px; border-radius: 3px; background: rgba(18, 18, 18, .28); }
}
@media (min-width: 701px) { .qc-keo { display: none; } }
/* hộp nằm trong khung có kính mờ (backdrop-filter) thì "fixed" bị neo vào khung đó → tạm bỏ kính khi bảng đang mở */
@media (max-width: 700px) {
  .tt-bar:has(.qc-sheet:not([hidden])) { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; filter: none !important; transform: none !important; contain: none !important; will-change: auto !important; }
}

/* ---------- thanh thẻ dưới đáy (Góc học tập) ---------- */
.qc-thanh { display: none; }
@media (max-width: 899px) {
  html.qc-co-thanh .qc-thanh { position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; display: grid; grid-template-columns: repeat(5, 1fr);
    padding: 4px max(6px, env(safe-area-inset-right, 0px)) calc(4px + env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-left, 0px));
    background: rgba(251, 248, 241, .96); -webkit-backdrop-filter: blur(14px) saturate(1.3); backdrop-filter: blur(14px) saturate(1.3);
    border-top: 1px solid rgba(58, 74, 50, .18); box-shadow: 0 -6px 20px rgba(31, 42, 53, .06);
    transition: transform .22s cubic-bezier(.23, 1, .32, 1); }
  html.qc-co-thanh.qc-an-thanh .qc-thanh { transform: translateY(110%); }
  .qc-thanh a, .qc-thanh button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-width: 0; min-height: 52px; padding: 4px 2px; border: 0; border-radius: 12px; background: none; color: #625E51; text-decoration: none;
    font: 600 11.5px/1.2 "Be Vietnam Pro", system-ui, sans-serif; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
  .qc-thanh svg { width: 23px; height: 23px; transition: transform .12s ease-out; }
  .qc-thanh span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .qc-thanh [aria-current="page"] { color: #3A4A32; font-weight: 700; }
  .qc-thanh [aria-current="page"]::before { content: ""; position: absolute; top: 3px; left: 50%; width: 46px; height: 30px; margin-left: -23px; border-radius: 15px; background: rgba(95, 109, 69, .16); z-index: -1; }
  .qc-thanh :active svg { transform: scale(.9); }
  .qc-thanh i { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: #B25D2A; color: #fff;
    font: 700 10.5px/17px "Be Vietnam Pro", system-ui, sans-serif; font-style: normal; text-align: center; }
  .qc-thanh i:empty { display: none; }
  html.qc-co-thanh body { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
  /* 11/11: thanh mục ngang cũ ở đầu trang trùng với thanh dưới → ẩn trên điện thoại (mọi mục vẫn có trong bảng "Thêm"); laptop giữ nguyên */
  html.qc-co-thanh .dash-side { display: none !important; }
  /* thẻ hướng dẫn lần đầu nằm trên thanh dưới để thấy mục đang được chỉ */
  html.qc-co-thanh .hd-the.hd-day { bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important; max-height: calc(100dvh - 160px); }
  /* nút nổi ở góc dưới (cài app, về đầu trang, nhạc) nhích lên trên thanh */
  html.qc-co-thanh .pwa-ht { bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important; }
  html.qc-co-thanh:not(.qc-an-thanh) .qc-tren-thanh { transform: translateY(calc(-64px - env(safe-area-inset-bottom, 0px))); }
  html.gb-toi .qc-thanh { background: rgba(28, 33, 26, .96); border-top-color: rgba(255, 255, 255, .12); }
  html.gb-toi .qc-thanh a, html.gb-toi .qc-thanh button { color: #C9C3B2; }
  html.gb-toi .qc-thanh [aria-current="page"] { color: #F3EEDF; }
}

/* bảng "Thêm" của thanh dưới */
.qc-them-nen { position: fixed; inset: 0; z-index: 950; background: rgba(20, 32, 44, .38); animation: qc-mo-nen .2s ease-out; }
.qc-them { position: fixed; left: 0; right: 0; bottom: 0; z-index: 951; max-height: 86dvh; overflow-y: auto; overscroll-behavior: contain;
  padding: 24px max(14px, env(safe-area-inset-right, 0px)) calc(14px + env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px));
  border-radius: 18px 18px 0 0; background: #FBF8F1; color: #2B2A25; box-shadow: 0 -10px 40px rgba(20, 32, 44, .2);
  animation: qc-len .3s cubic-bezier(.23, 1, .32, 1); font-family: "Be Vietnam Pro", system-ui, sans-serif; }
.qc-them h2 { margin: 2px 4px 10px; font: 700 19px/1.3 Lora, Georgia, serif; color: #3A4A32; }
.qc-them p { margin: 14px 4px 4px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #625E51; }
.qc-them .qc-luoi { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.qc-them a { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 12px; border-radius: 10px; border: 1px solid rgba(58, 74, 50, .14);
  background: #fff; color: #2B2A25; font-size: 14.5px; font-weight: 600; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.qc-them a:active { background: #EFEBDD; }
.qc-them a[aria-current="page"] { border-color: #5F6D45; color: #3A4A32; box-shadow: inset 0 0 0 1px #5F6D45; }
.qc-them a svg { width: 20px; height: 20px; flex: none; color: #5F6D45; }
.qc-them a i { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #B25D2A; color: #fff; font: 700 11px/18px inherit; font-style: normal; text-align: center; }
.qc-them a i:empty { display: none; }
.qc-them .qc-dong { display: block; width: 100%; min-height: 48px; margin-top: 14px; border: 1px solid rgba(58, 74, 50, .25); border-radius: 10px; background: none;
  color: #3A4A32; font: 700 15px "Be Vietnam Pro", system-ui, sans-serif; cursor: pointer; }
html.gb-toi .qc-them { background: #1F241C; color: #EDE8D8; }
html.gb-toi .qc-them a { background: #2A3025; color: #EDE8D8; border-color: rgba(255, 255, 255, .1); }
html.gb-toi .qc-them h2 { color: #E3DCC6; }

/* ---------- Góc học tập: vùng chạm còn nhỏ ---------- */
@media (max-width: 899px) {
  .rg-goal-btns button { min-width: 36px; min-height: 30px; position: relative; touch-action: manipulation; }
  .rg-goal-btns button::after { content: ""; position: absolute; inset: -4px -4px; }
  html.qc-co-thanh .dash-wrap .rg-time button, html.qc-co-thanh .rg-time button { height: auto; min-height: 40px; position: relative; touch-action: manipulation; }
  html.qc-co-thanh .rg-time button::after { content: ""; position: absolute; inset: -2px 0; }
  html .hd-tat { min-height: 44px; display: inline-flex; align-items: center; }
  .p-user, .p-ulink { position: relative; }
  .p-user::after, .p-ulink::after { content: ""; position: absolute; inset: -4px; }
}

/* ---------- LMS giáo viên (/giao-vien) trên điện thoại ---------- */
@media (max-width: 860px) {
  .gv-thanh { padding-top: max(8px, env(safe-area-inset-top, 0px)); padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .gv-lien { min-height: 40px; display: inline-flex; align-items: center; position: relative; touch-action: manipulation; }
  .gv-lien::after { content: ""; position: absolute; inset: -2px 0; }
  .gv-logo { min-height: 44px; }
  .gv-app input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]),
  .gv-app select, .gv-app textarea, .gv-mo-hop input:not([type=checkbox]):not([type=radio]), .gv-mo-hop textarea, .gv-mo-hop select { font-size: 16px !important; min-height: 44px; }
  .gv-app textarea { min-height: 88px; }
  .gv-app input[type=checkbox], .gv-app input[type=radio] { width: 20px; height: 20px; flex: none; }
  .gv-app label:has(> input[type=checkbox]), .gv-app label:has(> input[type=radio]) { min-height: 44px; }
  /* thẻ mục: cuộn ngang được, nút Tải lại luôn thấy ở mép phải */
  .gv-tab { scroll-snap-type: x proximity; scrollbar-width: none; }
  .gv-tab::-webkit-scrollbar { display: none; }
  .gv-tab button { min-height: 44px; scroll-snap-align: start; touch-action: manipulation; }
  .gv-tab .gv-tai-lai { position: sticky; right: 0; flex: none; width: 44px; min-height: 44px; padding: 0; margin-left: auto; display: grid; place-items: center; font-size: 0; background: var(--nen, #F5F2EB); box-shadow: -14px 0 12px -4px var(--nen, #F5F2EB); }
  .gv-tab .gv-tai-lai::before { content: "↻"; font-size: 19px; line-height: 1; }
  .gv-app .gv-nut, .gv-app button.gv-nho { min-height: 44px; touch-action: manipulation; }
}

/* ---------- chạm ---------- */
@media (hover: none) and (pointer: coarse) {
  .qc-thanh a, .qc-them a, .qc-sheet button { -webkit-tap-highlight-color: transparent; }
}

/* ---------- giảm chuyển động ---------- */
@media (prefers-reduced-motion: reduce) {
  .qc-sheet, .qc-them, .qc-them-nen { animation: qc-mo-nen .15s linear !important; }
  .qc-mang, .qc-thanh, .qc-sheet.qc-tha { transition: opacity .15s linear !important; }
  html { scroll-behavior: auto !important; }
}

@media print { .qc-thanh, .qc-mang, .qc-them, .qc-them-nen { display: none !important; } }
