/* ============================================================
 * IT LEARN — Page navigation utilities (reusable)
 *   • Section nav (right-side dot navigation)
 *   • Back-to-top button
 *   • Footer social icons
 *   • Active state for cross-page nav links
 * ============================================================ */

/* Offset cho sticky header khi scroll tới section */
section[id] { scroll-margin-top: 80px; }

/* Active state cho nav link đang ở trang hiện tại */
.nav-links a.active {
  color: var(--text, #f1f5f9);
  background: rgba(248, 113, 113, .12);
}

/* ====================================
 * PER-PAGE BACKGROUND TINT
 *   Mỗi trang có ambient màu riêng để phân biệt nhanh
 *   bằng mắt — brand đỏ vẫn giữ ở buttons & text.
 * ==================================== */

/* Trang chủ: red + navy mix (full brand) */
body.page-home {
  --bg-glow-1: rgba(220, 38, 38, .42);   /* red strong top-right */
  --bg-glow-2: rgba(37, 99, 235, .38);   /* navy strong left */
  --bg-glow-3: rgba(255, 108, 55, .15);  /* orange hint bottom (Postman accent) */
}

/* Manual Testing: đỏ chủ đạo */
body.page-manual {
  --bg-glow-1: rgba(220, 38, 38, .35);   /* red strong */
  --bg-glow-2: rgba(30, 64, 175, .25);   /* navy */
  --bg-glow-3: rgba(220, 38, 38, .18);   /* red soft */
}

/* ISTQB CTFL: navy chủ đạo (match logo ISTQB) */
body.page-istqb {
  --bg-glow-1: rgba(37, 99, 235, .50);   /* navy strong top-right */
  --bg-glow-2: rgba(96, 165, 250, .35);  /* light blue accent */
  --bg-glow-3: rgba(220, 38, 38, .12);   /* red brand hint */
}

/* AI for Tester: tím chủ đạo (theme AI) — override --red-* tokens với violet
   để tận dụng toàn bộ component reuse mà không cần class-rename. */
body.page-ai {
  --bg-glow-1: rgba(139, 92, 246, .48);   /* violet strong top-right */
  --bg-glow-2: rgba(168, 85, 247, .35);   /* lighter violet left */
  --bg-glow-3: rgba(56, 189, 248, .22);   /* cyan accent bottom */

  --red:        #8b5cf6;
  --red-2:      #a855f7;
  --red-bright: #c4b5fd;
  --red-soft:   #ddd6fe;
  --red-deep:   #6d28d9;
  --grad:       linear-gradient(135deg, #a855f7 0%, #8b5cf6 60%, #6d28d9 100%);
  --shadow-red: 0 20px 60px -20px rgba(139, 92, 246, .55);
}
body.page-ai .gradient-text {
  background-image: linear-gradient(120deg, #ddd6fe 0%, #a855f7 40%, #c4b5fd 100%);
}
body.page-ai .nav-links a.active {
  background: rgba(196, 181, 253, .14);
}
/* Override price-card featured red gradient → violet */
body.page-ai .price-card.feat {
  background: linear-gradient(180deg, #4c1d95 0%, #2e1065 100%);
  border-color: rgba(196, 181, 253, .35);
}

/* API Postman: cam chủ đạo (match Postman #ff6c37) */
body.page-api {
  --bg-glow-1: rgba(255, 108, 55, .45);  /* postman orange top-right */
  --bg-glow-2: rgba(30, 64, 175, .22);   /* navy left */
  --bg-glow-3: rgba(251, 146, 60, .20);  /* light orange bottom */
}

/* ====================================
 * MOBILE BURGER MENU
 *   Auto-injected vào .site-header .nav bởi page-nav.js.
 *   Hiện <980px (cùng breakpoint với .nav-links).
 * ==================================== */
.nav-burger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin-left: 8px;
  padding: 0;
  border: 1px solid var(--line, rgba(255,255,255,.08));
  background: rgba(255,255,255,.04);
  border-radius: 10px;
  color: var(--text, #f1f5f9);
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.nav-burger:hover {
  background: rgba(255,255,255,.08);
  border-color: var(--line-strong, rgba(255,255,255,.14));
}
.nav-burger .bar,
.nav-burger .bar::before,
.nav-burger .bar::after {
  display: block;
  width: 20px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform .25s ease, top .25s ease, background .15s ease;
}
.nav-burger .bar { position: relative; }
.nav-burger .bar::before,
.nav-burger .bar::after {
  content: '';
  position: absolute;
  left: 0;
}
.nav-burger .bar::before { top: -7px; }
.nav-burger .bar::after  { top:  7px; }
.nav-burger.is-active .bar { background: transparent; }
.nav-burger.is-active .bar::before { top: 0; transform: rotate(45deg); }
.nav-burger.is-active .bar::after  { top: 0; transform: rotate(-45deg); }

@media (min-width: 980px) {
  .nav-burger { display: none; }
}

/* Mobile drawer khi .nav-links có class .is-open */
@media (max-width: 979px) {
  .nav-links.is-open {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    padding: 14px 18px 20px;
    background: rgba(8, 13, 31, .96);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border-top: 1px solid var(--line, rgba(255,255,255,.08));
    border-bottom: 1px solid var(--line, rgba(255,255,255,.08));
    box-shadow: 0 18px 40px rgba(0,0,0,.5);
    animation: navSlideDown .22s ease-out;
  }
  .nav-links.is-open a {
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 15px;
  }
}
@keyframes navSlideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ====================================
 * SECTION NAV (right-side dots, desktop only)
 * ==================================== */
.section-nav {
  position: fixed;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 40;
  display: none;
}
@media (min-width: 1100px) {
  .section-nav { display: block; }
}
.section-nav ul {
  list-style: none;
  margin: 0;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: rgba(8, 13, 31, .55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line, rgba(255,255,255,.08));
  border-radius: 999px;
}
.section-nav a {
  display: flex;
  align-items: center;
  padding: 8px;
  border-radius: 999px;
  color: var(--text-dim, #94a3b8);
  text-decoration: none;
  position: relative;
  transition: background .2s;
}
.section-nav a:hover { background: rgba(255, 255, 255, .04); }
.section-nav .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .25);
  flex-shrink: 0;
  transition: all .3s ease;
}
.section-nav a:hover .dot,
.section-nav a.active .dot {
  background: var(--red-bright, #f87171);
  box-shadow: 0 0 12px rgba(248, 113, 113, .55);
}
.section-nav a.active .dot {
  width: 22px;
  border-radius: 4px;
}
.section-nav .label {
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(8px);
  font-size: 11px;
  font-family: var(--mono, monospace);
  color: var(--text, #f1f5f9);
  background: rgba(8, 13, 31, .94);
  border: 1px solid var(--line-strong, rgba(255,255,255,.14));
  border-radius: 6px;
  padding: 6px 10px;
  white-space: nowrap;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 500;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s, transform .2s;
}
.section-nav a:hover .label {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* ====================================
 * BACK-TO-TOP BUTTON
 * ==================================== */
.btn-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 50;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--grad, linear-gradient(135deg, #ef4444 0%, #dc2626 60%, #991b1b 100%));
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-red, 0 20px 60px -20px rgba(220,38,38,.55)),
              inset 0 1px 0 rgba(255,255,255,.25);
  border: 0;
  cursor: pointer;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .3s, transform .3s ease, box-shadow .25s ease;
}
.btn-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.btn-to-top:hover {
  transform: translateY(-3px);
  box-shadow: 0 25px 70px -18px rgba(220, 38, 38, .75),
              inset 0 1px 0 rgba(255,255,255,.3);
}
@media (max-width: 480px) {
  .btn-to-top {
    width: 42px;
    height: 42px;
    bottom: 16px;
    right: 16px;
  }
}

/* ====================================
 * FOOTER SOCIAL ICONS
 * ==================================== */
.foot-social {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 18px 0 0;
}
.foot-social a {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--line, rgba(255,255,255,.08));
  display: grid;
  place-items: center;
  color: var(--text-dim, #94a3b8);
  transition: all .25s ease;
}
.foot-social a:hover {
  background: rgba(248, 113, 113, .14);
  border-color: rgba(248, 113, 113, .4);
  color: var(--red-bright, #f87171);
  transform: translateY(-2px);
}
.foot-social svg {
  width: 18px;
  height: 18px;
}
