﻿/* ============================================================
   Mobile Responsive Fix — STEM Computer
   Targets: Navbar + Guide + Guide Detail + Support pages
   Breakpoints: 480px (mobile) | 768px (tablet) | 1024px (navbar)
   ============================================================ */

/* ---- Global mobile reset --------------------------------- */
@media (max-width: 1024px) {

  /* No horizontal scroll anywhere */
  html, body {
    overflow-x: hidden;
    max-width: 100vw;
  }

  /* Tap highlight: remove grey flash */
  * {
    -webkit-tap-highlight-color: transparent;
  }

  /* Images always fluid */
  img {
    max-width: 100%;
    height: auto;
  }
}

/* ============================================================
   NAVBAR — switches to hamburger at 1024px
   (prevents wrapping when zoomed or on small laptops)
   ============================================================ */

@media (max-width: 1024px) {

  /* Header: tighten horizontal padding */
  .header-inner {
    padding: 0 16px;
    gap: 8px;
  }

  /* Logo: keep left, slightly smaller text */
  .logo {
    font-size: 1.1rem;
    gap: 8px;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .logo-icon {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    font-size: 1.2rem;
  }

  .logo .logo-img {
    width: 38px;
    height: 38px;
  }

  /* Hamburger: always show, styled nicely */
  .menu-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(79,70,229,.08);
    font-size: 1.3rem;
    flex-shrink: 0;
    order: 3;
    transition: background 0.2s ease;
  }

  .menu-toggle:hover,
  .menu-toggle.active {
    background: rgba(79,70,229,.15);
  }

  /* Header actions: hide on mobile — goes into mobile menu */
  .header-actions {
    display: none;
  }

  /* Nav menu: slide-down dropdown */
  .nav-menu {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: #fff;
    flex-direction: column;
    padding: 12px 16px 20px;
    border-bottom: 2px solid var(--border);
    box-shadow: 0 8px 24px rgba(0,0,0,.1);
    gap: 4px;
    z-index: 999;
    /* Slide animation */
    transform: translateY(-10px);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
    pointer-events: none;
  }

  .nav-menu.open {
    display: flex;
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  /* Nav links: larger touch target */
  .nav-link {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.95rem;
    width: 100%;
    display: flex;
    align-items: center;
    min-height: 44px;
  }

  /* Mobile user panel (appended by JS into open menu) */
  .mobile-user-panel {
    border-top: 1px solid var(--border);
    margin-top: 8px;
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .mobile-user-panel .user-name {
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--text-muted);
    padding: 0 16px;
  }

  .mobile-user-panel .btn {
    width: 100%;
    justify-content: center;
    padding: 12px 20px;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .header-inner { padding: 0 12px; }
  .logo { font-size: 1rem; }
  .logo-icon { width: 34px; height: 34px; }
  .logo .logo-img { width: 34px; height: 34px; }
}

/* Desktop: make sure nav/actions show above 1024px */
@media (min-width: 1025px) {
  .nav-menu {
    display: flex !important;
    position: static;
    flex-direction: row;
    background: transparent;
    box-shadow: none;
    padding: 0;
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }
  .header-actions { display: flex !important; }
  .menu-toggle { display: none !important; }
}

/* ============================================================
   PAGE 1 — Guide List (gp-*)
   ============================================================ */

@media (max-width: 768px) {

  .gp-page {
    padding: 88px 16px 64px;
  }

  .gp-deco { display: none; }

  .gp-hero__mascot { font-size: 3.5rem; }
  .gp-hero__title  { font-size: 1.75rem; }

  .gp-progress {
    padding: 0 4px;
    gap: 8px;
  }

  .gp-card {
    padding: 16px 14px;
    gap: 12px;
    border-radius: 16px;
  }

  .gp-card__icon {
    width: 48px;
    height: 48px;
    font-size: 1.4rem;
    border-radius: 13px;
  }

  .gp-card__title { font-size: 1.0rem; }
  .gp-card__desc  { font-size: 0.85rem; }

  .gp-card__step {
    font-size: 0.7rem;
    padding: 5px 10px;
  }

  .gp-card__arrow {
    width: 40px;
    height: 40px;
    font-size: 1.3rem;
    flex-shrink: 0;
  }

  .gp-steps { gap: 12px; }

  .gp-cta__btn {
    width: 100%;
    justify-content: center;
    padding: 16px 24px;
    font-size: 1.1rem;
    min-height: 52px;
  }
}

@media (max-width: 480px) {

  .gp-page { padding: 88px 12px 56px; }

  .gp-hero__mascot { font-size: 3rem; }
  .gp-hero__title  { font-size: 1.4rem; }
  .gp-hero__subtitle { font-size: 0.9rem; }

  .gp-progress__star { font-size: 1.1rem; }

  .gp-card {
    padding: 14px 12px;
    gap: 10px;
  }

  .gp-card__icon {
    width: 44px;
    height: 44px;
    font-size: 1.25rem;
    border-radius: 12px;
    flex-shrink: 0;
  }

  .gp-card__title { font-size: 0.95rem; }
  .gp-card__desc  { font-size: 0.82rem; }

  .gp-card__arrow {
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
  }
}

/* ============================================================
   PAGE 2 — Guide Detail (gd-*)
   ============================================================ */

@media (max-width: 768px) {

  .gd-page {
    padding: 88px 16px 64px;
  }

  .gd-sparkle { display: none; }

  /* Breadcrumb: horizontal scroll, no wrap */
  .gd-breadcrumb {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 2px;
    gap: 6px;
  }
  .gd-breadcrumb::-webkit-scrollbar { display: none; }

  .gd-breadcrumb__item {
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 0.75rem;
    padding: 5px 12px;
  }

  /* Hero: stack column, hide mascot */
  .gd-hero {
    flex-direction: column;
    padding: 24px 20px 20px;
    gap: 16px;
  }

  .gd-hero__mascot {
    display: none;
  }

  .gd-hero__title { font-size: 1.45rem; }

  .gd-hero__badges {
    flex-wrap: wrap;
    gap: 6px;
  }

  .gd-hero__badge { font-size: 0.7rem; padding: 4px 10px; }

  /* Progress */
  .gd-progress {
    padding: 16px 18px;
    margin-bottom: 20px;
  }

  .gd-progress__dot { width: 24px; height: 8px; }
  .gd-progress__dot--active { width: 36px; }

  /* Article body */
  .gd-article-body {
    padding: 24px 18px;
    font-size: 0.95rem;
  }

  .gd-article-body li {
    padding: 14px 16px;
    gap: 10px;
  }

  /* Success banner */
  .gd-success {
    padding: 24px 20px;
    text-align: center;
  }

  .gd-success__title { font-size: 1.15rem; }

  /* CTA */
  .gd-cta {
    flex-direction: column;
    gap: 10px;
  }

  .gd-cta__btn {
    width: 100%;
    justify-content: center;
    min-height: 52px;
    font-size: 1rem;
    padding: 14px 24px;
  }
}

@media (max-width: 480px) {

  .gd-page { padding: 88px 12px 56px; }

  .gd-hero { padding: 20px 16px 18px; }
  .gd-hero__title { font-size: 1.25rem; }
  .gd-hero__subtitle { font-size: 0.88rem; }

  .gd-article-body {
    padding: 20px 14px;
    border-radius: 18px;
  }

  .gd-article-body h2 { font-size: 1.1rem; }
  .gd-article-body h3 { font-size: 0.98rem; }

  .gd-article-body li {
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 0.9rem;
    border-left-width: 4px;
  }

  .gd-success { border-radius: 18px; }
  .gd-success__icon { font-size: 2.5rem; }
  .gd-success__title { font-size: 1.05rem; }
}

/* ============================================================
   PAGE 3 — Support & FAQ (sp-*)
   ============================================================ */

@media (max-width: 768px) {

  .sp-page {
    padding: 88px 16px 64px;
  }

  .sp-sparkle { display: none; }

  /* Hero */
  .sp-hero {
    flex-direction: column;
    padding: 24px 20px 20px;
    gap: 12px;
  }

  .sp-hero__mascot { display: none; }

  .sp-hero__title    { font-size: 1.6rem; }
  .sp-hero__subtitle { font-size: 0.9rem; margin-bottom: 16px; }
  .sp-hero__icon     { font-size: 1.8rem; }

  /* Search: full width, proper height */
  .sp-search { max-width: 100%; }

  .sp-search__input {
    height: 48px;
    font-size: 0.92rem;
    padding: 0 18px 0 44px;
  }

  /* Category pills: horizontal scroll, swipe-friendly */
  .sp-filters {
    padding: 0 0 8px;
    gap: 8px;
    /* allow overflow scroll, but no scrollbar shown */
    -webkit-overflow-scrolling: touch;
  }

  .sp-filter-pill {
    padding: 10px 16px;
    font-size: 0.82rem;
    min-height: 44px;
  }

  /* FAQ Cards */
  .sp-card {
    padding: 16px 14px;
    gap: 12px;
    border-left-width: 4px;
    border-radius: 16px;
  }

  .sp-card__badge {
    width: 50px;
    height: 50px;
    border-radius: 13px;
    flex-shrink: 0;
  }

  .sp-card__badge-icon { font-size: 1.25rem; }
  .sp-card__badge-num  { font-size: 0.65rem; }

  .sp-card__title { font-size: 0.98rem; }
  .sp-card__desc  { font-size: 0.84rem; }

  .sp-card__arrow {
    width: 38px;
    height: 38px;
    font-size: 1.2rem;
    flex-shrink: 0;
  }

  /* Contact banner */
  .sp-contact {
    flex-direction: column;
    text-align: center;
    padding: 24px 20px;
    gap: 16px;
  }

  .sp-contact__heading { font-size: 1.1rem; }
  .sp-contact__sub     { font-size: 0.88rem; }

  .sp-contact__actions {
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }

  .sp-contact__btn {
    width: 100%;
    justify-content: center;
    min-height: 48px;
    font-size: 0.95rem;
    padding: 12px 20px;
  }
}

@media (max-width: 480px) {

  .sp-page { padding: 88px 12px 56px; }

  .sp-hero { padding: 20px 16px 18px; }
  .sp-hero__title { font-size: 1.35rem; }

  .sp-filter-pill {
    padding: 8px 14px;
    font-size: 0.8rem;
  }

  .sp-card {
    padding: 14px 12px;
    gap: 10px;
  }

  .sp-card__badge {
    width: 44px;
    height: 44px;
    border-radius: 11px;
  }

  .sp-card__badge-icon { font-size: 1.1rem; }

  .sp-card__title { font-size: 0.92rem; }
  .sp-card__desc  { font-size: 0.8rem; }

  .sp-card__arrow { width: 34px; height: 34px; }

  .sp-cards { gap: 10px; }
}

/* Nền trang công khai — mobile */
@media (max-width: 768px) {
  body.site-public.site-has-bg::before {
    background-attachment: scroll;
  }

  body.site-public.site-has-bg::after {
    background: rgba(244, 247, 251, 0.82);
  }
}

