/* Mobile Responsive Styles - Optimized & Fixed */

/* --- Tablet / Landscape Mobile (<= 1023px) --- */
@media (max-width: 1023px) {
  :root {
      --tzq-header-height: 60px; /* Force smaller header height on mobile */
  }

  html {
    scroll-behavior: smooth;
    font-size: clamp(15px, 3vw, 16px);
  }

  /* Reset layout containers to full width */
  .tzq-container,
  .container,
  .tzq-page-wrapper,
  .site-content,
  .tzq-content,
  .content-main,
  .site-main,
  .tzq-section,
  .tzq-page-section,
  .tzq-content-surface,
  .tzq-page-content,
  .tzq-editor-content,
  .entry-content {
    width: 100%;
    max-width: 100%;
  }

  /* Navbar Layout Reset for Mobile */
  .tzq-navbar__content {
      min-height: var(--tzq-header-height);
      padding: 0;
  }

  /* Force single column layouts */
  .site-content.sidebar-left,
  .site-content.sidebar-right,
  .tzq-page--with-sidebar,
  .tzq-calc-layout,
  .tzq-layout,
  .tzq-main-wrapper.has-sidebar {
    display: flex !important;
    flex-direction: column !important;
    gap: var(--tzq-spacing-lg) !important;
  }
.tzq-navbar{
  height:85px!important;
}
  /* Content First */
  .site-content .content-main,
  .site-content .tzq-content,
  .site-content .site-main,
  .tzq-calc-layout > .tzq-calc-main,
  .tzq-layout__main,
  .tzq-page--with-sidebar > .tzq-content,
  .tzq-main-wrapper.has-sidebar .tzq-content-area {
    order: 1 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Sidebar Second */
  .site-content .site-sidebar,
  .site-content .tzq-sidebar,
  .tzq-calc-layout > .tzq-sidebar,
  .tzq-calc-layout > .tzq-calc-aside,
  .tzq-layout__sidebar,
  .tzq-page--with-sidebar > .tzq-sidebar,
  .tzq-main-wrapper.has-sidebar .tzq-sidebar {
    order: 2 !important;
    width: 100% !important;
    max-width: 100% !important;
    position: static !important;
    margin-top: var(--tzq-spacing-lg);
  }

  /* Mobile Padding Adjustments */
  .tzq-section-inner,
  .tzq-section-inner-full {
    padding-left: clamp(0.75rem, 2vw, 1.25rem);
    padding-right: clamp(0.75rem, 2vw, 1.25rem);
  }

  /* Card Layouts */
  .tzq-card,
  .tzq-test-card,
  .tzq-feature-card,
  .tzq-card__body,
  .tzq-form--profile {
    width: 100%;
    max-width: 100%;
    padding: clamp(var(--tzq-spacing-md), 2vw, var(--tzq-spacing-lg));
  }
  
  .tzq-form--profile .tzq-form-group__input,
  .tzq-form--profile .tzq-form-group__select,
  .tzq-form--profile textarea {
    font-size: 16px; /* Prevent zoom on iOS */
  }

  /* Grid Resets */
  .tzq-cards-grid,
  .tzq-grid,
  .tzq-cards-grid.tzq-cards-3-cols,
  .tzq-cards-grid.tzq-cards-4-cols,
  .tzq-list__item--test-detailed,
  .tzq-stats-grid--profile,
  .tzq-info-grid,
  .tzq-question__options,
  .tzq-quiz-row,
  .tzq-game-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--tzq-spacing-md);
  }

  /* Navbar Mobile Overrides */
  .tzq-navbar__menu-row,
  .tzq-navbar__menu,
  .tzq-navbar__actions > *:not(.tzq-navbar__mobile-btn),
  .tzq-navbar__top-actions > *:not(.tzq-navbar__mobile-btn) {
    display: none !important;
  }

  .tzq-navbar__logo-text { font-size: 1.25rem; } /* Smaller logo text */
  .tzq-navbar__logo-image { max-width: 140px; height: auto; }

  /* Hamburger Menu Button */
  .tzq-navbar__mobile-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: var(--tzq-spacing-3);
    color: var(--tzq-text-secondary);
    background: transparent;
    border: 1px solid var(--tzq-border-light); 
    border-radius: var(--tzq-radius-md);
    cursor: pointer;
    min-width: 40px;
    height: 40px;
    margin-left: auto; /* Push to right */
    touch-action: manipulation;
  }
  
  .tzq-navbar__mobile-btn--active {
    background: var(--tzq-primary-light);
    color: var(--tzq-primary);
    border-color: var(--tzq-primary);
  }

  /* Mobile Dropdown Menu (Hamburger Content) */
  .tzq-navbar__mobile-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--tzq-bg-primary);
    border-top: 1px solid var(--tzq-border-light);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    z-index: 9999;
    padding: var(--tzq-spacing-md);
  }
  
  .tzq-navbar__mobile-menu.active, 
  .tzq-navbar__mobile-menu--active { 
      display: block !important; 
  }
  
  .tzq-navbar__mobile-nav {
      display: flex;
      flex-direction: column;
      gap: var(--tzq-spacing-sm);
  }
  
  .tzq-navbar__mobile-item {
    padding: var(--tzq-spacing-sm) var(--tzq-spacing-md);
    border-radius: var(--tzq-radius-md);
    text-decoration: none;
    color: var(--tzq-text-primary);
    display: flex;
    align-items: center;
    gap: var(--tzq-spacing-sm);
    min-height: 44px;
    font-weight: 500;
    border: 1px solid transparent;
  }
  
  .tzq-navbar__mobile-item:active,
  .tzq-navbar__mobile-item:hover {
      background: var(--tzq-bg-secondary);
      color: var(--tzq-primary);
  }

  .tzq-navbar__mobile-item--btn {
    background: var(--tzq-gradient-primary);
    color: var(--tzq-text-inverse);
    justify-content: center;
    font-weight: 600;
    margin-top: var(--tzq-spacing-md);
  }

  /* Bottom Navigation Bar (Mobile Only) */
  body {
    padding-bottom: calc(60px + env(safe-area-inset-bottom)); /* Add padding to body */
  }
  
  .tzq-bottom-bar {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--tzq-bg-primary);
    border-top: 1px solid var(--tzq-border-light);
    z-index: 10000;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    padding-bottom: env(safe-area-inset-bottom);
  }
  
  .tzq-bottom-bar__item {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      flex: 1;
      height: 100%;
      color: var(--tzq-text-secondary);
      text-decoration: none;
      font-size: 0.7rem;
      gap: 4px;
  }
  
  .tzq-bottom-bar__item svg {
      width: 24px;
      height: 24px;
      stroke-width: 2px;
  }
  
  .tzq-bottom-bar__item--active,
  .tzq-bottom-bar__item:active {
      color: var(--tzq-primary);
  }

  /* Table Reset */
  table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* --- Mobile Portrait (<= 768px) --- */
@media (max-width: 768px) {
  /* Typography */
  .tzq-page-header__title { font-size: 1.5rem !important; line-height: 1.3 !important; }
  .tzq-page-header__stat-value { font-size: 1.1rem !important; }
  .tzq-page-header__stat-label { font-size: 0.75rem !important; }
  
  /* Flex/Grid Conversions */
  .tzq-page-header__stats { 
      grid-template-columns: repeat(2, 1fr) !important; 
      gap: 10px !important; 
  }
  .tzq-page-header__actions { flex-direction: column !important; }
  
  /* Game Area */
  .game-container, .iframe-container, .tzq-game-engine {
      width: 100% !important;
      border-radius: var(--tzq-radius-md) !important;
  }
  .tzq-game-engine iframe { min-height: 480px; }

  /* Footer Adjustments */
  .tzq-footer__content { gap: var(--tzq-spacing-xl); text-align: center; }
  .tzq-footer__brand, .tzq-footer__menu-column { text-align: center; margin-bottom: var(--tzq-spacing-lg); }
  .tzq-footer__logo { justify-content: center; }
  
  .tzq-footer__bottom { flex-direction: column; gap: var(--tzq-spacing-md); }
  .tzq-footer__social { justify-content: center; }
  
  /* Scroll Top Button - Position above bottom bar */
  .tzq-scroll-top-btn { bottom: 80px; right: 20px; width: 48px; height: 48px; }
}