/* ═══════════════════════════════════════════════════════════
   css/mobile.css — Complete Mobile & Responsive Overhaul
   AcadTools.Online
═══════════════════════════════════════════════════════════ */

/* ── Global Container ── */
.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 var(--sp6); }

/* ── 1. NAVBAR — Mobile ── */
@media (max-width: 900px) {
  .nav-container { padding: 0 var(--sp4); }
  .nav-cats { 
    display: flex; 
    position: absolute; 
    top: calc(100% + 10px); 
    right: var(--sp4); 
    left: auto; 
    width: 250px; 
    height: auto; 
    max-height: calc(100vh - 80px); 
    background: var(--deep); 
    border: 1px solid var(--border-glow);
    border-radius: var(--r3); 
    padding: var(--sp2) 0; 
    z-index: 1000; 
    flex-direction: column; 
    overflow-y: auto; 
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-xl);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
  }
  .nav-cats.mobile-open { opacity: 1; visibility: visible; transform: translateY(0); }
  .nav-cat-wrap { width: 100%; border-bottom: 1px solid rgba(255,255,255,0.03); }
  .nav-cat { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: var(--sp4) var(--sp6); border-radius: 0; font-size: 15px; font-weight: 600; color: var(--text); }
  .nav-cat-underline { display: none; }
  .nav-cat-dot { display: inline-block; width: 8px; height: 8px; margin-right: 10px; flex-shrink: 0; }
  .nav-mega-dropdown { position: static !important; opacity: 1 !important; visibility: visible !important; transform: none !important; box-shadow: none !important; background: rgba(0,0,0,0.15) !important; border: none !important; border-radius: 0 !important; padding: 0 !important; display: none; width: 100%; }
  .nav-cat-wrap.dd-open .nav-mega-dropdown { display: block; }
  .dd-item { padding: var(--sp2) var(--sp8); }
  
  /* Auth buttons in header row — compact & aligned right */
  .nav-auth-btns { 
    display: flex;
    align-items: center;
    gap: 8px; 
    margin-left: auto; /* Pushes to right */
    margin-right: 12px; /* Space before hamburger */
    padding: 0;
    margin-top: 0;
    height: 100%;
  }
  
  /* Hide tool categories from header row on mobile */
  #navCats { display: none !important; } 
  #navCats.mobile-open { display: flex !important; } 
}

@media (max-width: 600px) {
  .nav-auth-btns { gap: 6px; }
  .nav-auth-btns .btn-sm { padding: 4px 8px; font-size: 11px; height: 30px; min-width: auto; }
  .nav-logo-text { font-size: 14px; }
  .nav-logo img { width: 24px !important; height: 24px !important; }
  .nav-container { height: 56px; }
}

@media (max-width: 450px) {
  .nav-auth-btns .auth-guest:nth-child(2), /* Hide Sign Up */
  .nav-auth-btns .header-username { 
    display: none !important; 
  }
}

@media (max-width: 400px) {
  .nav-logo-text { display: none; }
}

/* ── 2. HERO — Mobile ── */
@media (max-width: 1024px) {
  .hero-section { padding: var(--sp12) 0 var(--sp8); }
  .hero-terminal { display: none; }
  .hero-content { max-width: 100%; }
  .hero-title { font-size: clamp(32px, 5vw, 48px); }
  .hero-subtitle { font-size: 15px; }
}

@media (max-width: 600px) {
  .hero-section { padding: var(--sp6) 0 var(--sp6); }
  .hero-cta-row { flex-direction: column; gap: var(--sp3); margin-top: var(--sp6); }
  .hero-cta-row .btn { width: 100%; justify-content: center; padding: 14px; font-size: 15px; }
  .hero-title { font-size: 34px; line-height: 1.1; margin-bottom: var(--sp4); }
  .hero-title .line2 { display: inline; }
  .hero-badge { font-size: 10px; padding: 4px 10px; margin-bottom: var(--sp4); }
  .hero-subtitle { font-size: 14px; line-height: 1.6; opacity: 0.8; }
}

/* ── 3. TOOLS GRID — Mobile ── */
@media (max-width: 1024px) {
  .tools-grid { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 600px) {
  .tools-grid { grid-template-columns: 1fr !important; }
  .feature-grid { grid-template-columns: 1fr !important; }
}

/* ── 4. TOOL PAGES (Calculator Layout) — Mobile ── */
@media (max-width: 1100px) {
  .tool-page-wrap { grid-template-columns: 240px 1fr !important; }
}
@media (max-width: 900px) {
  .tool-page-wrap { display: flex !important; flex-direction: column; padding: var(--sp4) 0 var(--sp10); }
  .tool-sidebar { display: none; } /* Hidden on mobile — use mobile-tool-tabs instead */
  .tool-main { min-width: 0; width: 100%; }
  .tool-header-bar { flex-wrap: wrap; gap: var(--sp3); }
  .tool-hb-icon { font-size: 28px; }
  .tool-hb-title { font-size: clamp(18px, 4vw, 24px); }
  .right-ad-zone { display: none !important; }
  .below-tool-ad { display: none !important; }
}

@media (max-width: 600px) {
  .tool-widget-body { padding: var(--sp4); }
  .course-row { grid-template-columns: 1fr 70px 50px 30px; gap: 4px; }
  .course-row input, .course-row select { font-size: 12px; padding: 6px 8px; height: 32px; }
  .result-card .val { font-size: 40px; }
  .tool-article h2 { font-size: 18px; }
  .tool-article p { font-size: 14px; }
  .related-tools-grid { grid-template-columns: 1fr 1fr !important; }
  .faq-question { font-size: 13.5px; }
  .mobile-tool-tabs { gap: 0; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .mobile-tab { min-width: 70px; font-size: 11px !important; padding: var(--sp2) var(--sp3) !important; }
}

/* ── 5. MOBILE TOOL TABS — Always visible on small screens ── */
@media (max-width: 900px) {
  .mobile-tool-tabs { display: flex !important; }
}

/* ── 6. BREADCRUMB — Mobile ── */
@media (max-width: 600px) {
  .breadcrumb-bar { font-size: 11px; padding: var(--sp2) var(--sp4); flex-wrap: wrap; }
}

/* ── 7. FOOTER — Mobile ── */
@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr !important; gap: var(--sp6); }
  .footer-brand { grid-column: 1 / -1; }
  .footer-newsletter { max-width: 100%; }
  .footer-nl-row { flex-direction: column; gap: var(--sp2); }
  .footer-nl-row .btn { width: 100%; }
}
@media (max-width: 600px) {
  .footer-grid { grid-template-columns: 1fr !important; }
  .footer-bottom { flex-direction: column; gap: var(--sp2); text-align: center; }
  .footer-bottom-right { justify-content: center; }
  .site-footer { padding: var(--sp10) var(--sp4) var(--sp8); }
}

/* ── 8. SETTINGS PAGE — Mobile ── */
@media (max-width: 600px) {
  .settings-wrap { padding: var(--sp8) 0; }
  .setting-row { flex-direction: column; align-items: flex-start; gap: var(--sp3); }
  .setting-control { width: 100%; }
  .setting-control select { width: 100% !important; }
  .toggle-wrap { justify-content: flex-start; }
}

/* ── 9. BLOG PAGES — Mobile ── */
@media (max-width: 600px) {
  .blog-hero { padding: var(--sp10) 0 var(--sp6); }
  .blog-filter-bar { flex-direction: column; align-items: stretch; gap: var(--sp2); }
  .blog-search-wrap { margin-left: 0; }
  .blog-search-wrap input { width: 100%; box-sizing: border-box; }
  .blog-featured { grid-template-columns: 1fr !important; }
  .blog-featured-body { padding: var(--sp5); }
  .blog-grid { grid-template-columns: 1fr !important; }
  .post-wrap { padding: var(--sp6) 0 var(--sp12); }
  .post-meta { flex-direction: column; gap: var(--sp2); }
  .post-share { flex-wrap: wrap; }
  .related-grid { grid-template-columns: 1fr !important; }
}

/* ── 10. HOMEPAGE STATS — Mobile ── */
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr) !important; gap: var(--sp4); }
  .stat-val { font-size: clamp(24px, 5vw, 36px) !important; }
}

/* ── 11. FORMS — Mobile ── */
@media (max-width: 600px) {
  .form-group { margin-bottom: var(--sp4); }
  .form-input, .field-input, input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea { font-size: 16px !important; }
  .form-label { font-size: 12px; }
  .btn-full { width: 100%; }
}

/* ── 12. PROFILE PAGE — Mobile ── */
@media (max-width: 900px) {
  .profile-layout { flex-direction: column !important; }
  .profile-sidebar { width: 100% !important; position: static !important; }
}
@media (max-width: 600px) {
  .profile-header-row { flex-direction: column; gap: var(--sp4); }
  .stat-cards-row { grid-template-columns: repeat(2, 1fr) !important; }
}

/* ── 13. LOGIN / REGISTER — Mobile ── */
@media (max-width: 600px) {
  .auth-wrap { padding: var(--sp8) var(--sp4); }
  .auth-card { padding: var(--sp6) var(--sp5); }
}

/* ── 14. TOUCH DEVICES — Disable custom cursor ── */
@media (hover: none) and (pointer: coarse) {
  #cursor-glow { display: none !important; }
  .btn:hover { transform: none !important; }
  .tool-card:hover { transform: none !important; }
  .blog-card:hover { transform: none !important; }
}

/* ── 15. HAMBURGER MENU — Mobile Nav Toggle ── */
.hamburger { 
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: var(--sp2);
  background: none;
  border: none;
  z-index: 1001;
}
.hamburger .bar {
  width: 22px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all var(--t-mid) var(--t-ease);
}
.hamburger.active .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active .bar:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.active .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 900px) {
  .hamburger { display: flex; }
}


/* ── 16. MOBILE SIDEBAR REFINEMENTS ── */
@media (max-width: 900px) {
  .nav-cats {
    padding-top: var(--sp20);
    padding-bottom: var(--sp10);
  }
  .nav-sidebar-section {
    padding: var(--sp4) var(--sp6);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--sp2);
  }
  .nav-sidebar-label {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: var(--sp3);
  }
  .nav-sidebar-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
}

/* ── Mobile Dropdown Arrow Rotation ── */
@media (max-width: 900px) {
  .nav-cat[href="#"]::after {
    content: '';
    display: inline-block;
    width: 6px; height: 6px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    margin-left: 4px;
    transition: transform var(--t-mid) var(--t-ease);
    vertical-align: middle;
    position: relative;
    top: -2px;
  }
  .nav-cat-wrap.dd-open > .nav-cat[href="#"]::after {
    transform: rotate(-135deg);
    top: 2px;
  }
}

/* ── 16. MOBILE OVERLAY for nav ── */
.mobile-nav-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 998;
}
.mobile-nav-overlay.active { display: block; }

/* ── 17. CONTAINERS — Responsive padding ── */
@media (max-width: 600px) {
  .container { padding: 0 var(--sp4); }
  .section-label { font-size: 10px; }
}
@media (max-width: 400px) {
  .container { padding: 0 var(--sp3); }
}

/* ── 18. GRADE TABLE — Mobile scroll ── */
@media (max-width: 600px) {
  .grade-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .grade-table { min-width: 380px; }
}

/* ── 19. SECTION HEADINGS — Mobile ── */
@media (max-width: 600px) {
  .tool-article h2 { font-size: 17px; margin-top: var(--sp7); }
  .tool-article h3 { font-size: 15px; }
  .tool-article p { font-size: 13.5px; line-height: 1.75; }
}
