/* ============================================
   G2M MOBILE UX — Phase 4 (Overhauled)
   Premium mobile experience
   ============================================ */

/* ==========================================
   GLOBAL MOBILE RESETS (outside media query)
   These override style.css hardcoded values
   ========================================== */
@media (max-width: 1399px) {
  .container-fluid {
    width: 100% !important;
    max-width: 100% !important;
  }
}

@media (max-width: 768px) {
  body.body-color .container-fluid {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
    box-sizing: border-box !important;
  }

  /* HORIZONTAL CARD LAYOUT — Now defined globally in modern-cards.css */

  /* Card column wrapper — tighter spacing */
  .g2m-card-col {
    padding: 0 6px !important;
    margin-bottom: 0 !important;
  }
}

/* ---------- Bottom Navigation Bar ---------- */
.g2m-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid rgba(0,0,0,0.06);
  z-index: 9999;
  padding: 8px 0 env(safe-area-inset-bottom, 8px);
  justify-content: space-around;
  box-shadow: 0 -2px 20px rgba(0,0,0,0.08);
}

.g2m-bnav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.62rem;
  font-weight: 600;
  font-family: var(--font-primary);
  color: #9ca3af;
  gap: 3px;
  text-decoration: none !important;
  padding: 6px 14px;
  border-radius: 10px;
  transition: all 0.25s ease;
  position: relative;
  min-width: 52px;
}

.g2m-bnav-item i {
  font-size: 1.2rem;
  transition: transform 0.25s ease, color 0.25s ease;
}

.g2m-bnav-item.active {
  color: var(--g2m-accent);
}

.g2m-bnav-item.active i {
  transform: scale(1.15);
}

.g2m-bnav-item.active::before {
  content: '';
  position: absolute;
  top: -8px;
  width: 24px;
  height: 3px;
  background: var(--g2m-accent);
  border-radius: 0 0 4px 4px;
}

/* ---------- Search Overlay ---------- */
.g2m-search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.98);
  backdrop-filter: blur(12px);
  z-index: 10001;
  display: none;
  flex-direction: column;
  padding: 20px;
  animation: g2mSlideUp 0.3s ease;
}

.g2m-search-overlay.active {
  display: flex;
}

@keyframes g2mSlideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.g2m-search-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.g2m-search-close {
  width: 40px;
  height: 40px;
  border: none;
  background: var(--g2m-surface-alt);
  border-radius: 50%;
  font-size: 1.2rem;
  color: var(--g2m-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.g2m-search-input {
  flex: 1;
  font-size: 1.1rem;
  font-family: var(--font-primary);
  padding: 14px 20px;
  border: 2px solid var(--g2m-border);
  border-radius: var(--radius-md);
  outline: none;
  background: var(--g2m-surface);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.g2m-search-input:focus {
  border-color: var(--g2m-accent);
  box-shadow: 0 0 0 4px var(--g2m-accent-glow);
}

.g2m-search-input::placeholder {
  color: var(--g2m-text-muted);
}

/* ==========================================
   MOBILE BREAKPOINT — Main Overhaul
   ========================================== */
@media (max-width: 768px) {

  /* ---- Show bottom nav ---- */
  .g2m-bottom-nav {
    display: flex;
  }

  /* ---- Body spacing for bottom nav ---- */
  body.body-color {
    padding-bottom: 72px !important;
    overflow-x: hidden !important;
  }

  /* CRITICAL: Override the hardcoded 1800px width from style.css */
  .container-fluid {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
    box-sizing: border-box !important;
  }

  /* CRITICAL: Override the 20% floated images from style.css */
  .top-news img {
    width: 100% !important;
    float: none !important;
    margin-right: 0 !important;
    display: block !important;
    aspect-ratio: 16/9;
    object-fit: cover !important;
  }

  .top-news {
    padding-right: 0 !important;
  }

  .top-news h3 {
    font-size: 0.92rem !important;
    text-align: left !important;
  }

  .top-news p {
    font-size: 0.82rem !important;
    text-align: left !important;
  }

  /* ======================================
     TOP BAR — Compact & Clean
     ====================================== */
  .top-bar {
    padding: 6px 0 !important;
    border-bottom: 1px solid rgba(0,0,0,0.05) !important;
  }

  /* Hide Google Translate widget on mobile — it disrupts layout */
  .top-bar .language-main,
  .top-bar #google_element,
  .top-bar .col-md-3 {
    display: none !important;
  }

  /* Date display — clean & centered */
  .top-bar .mobile-date {
    width: 100% !important;
    flex: 0 0 100% !important;
    max-width: 100% !important;
    text-align: center !important;
    padding: 4px 0 !important;
  }

  .top-bar .mobile-date strong {
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    font-family: var(--font-primary) !important;
    color: var(--g2m-text-muted) !important;
  }

  /* Hide location form on mobile */
  .top-bar .loc-main,
  .top-bar .col-md-7 {
    display: none !important;
  }

  /* ======================================
     HEADER / LOGO / AD BANNER
     ====================================== */
  .header-middle {
    padding: 0 !important;
    margin: 0 !important;
  }

  .header-middle .container-fluid {
    padding: 0 12px !important;
  }

  /* Logo — compact & centered */
  .header-middle .logo {
    text-align: center !important;
    padding: 10px 0 6px !important;
  }

  .header-middle .logo img,
  .logo img {
    max-height: 40px !important;
    width: auto !important;
  }

  .header-middle .col-lg-2 {
    width: 100% !important;
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }

  /* Ad banner — responsive & hidden if too large */
  .header-middle .col-lg-9 {
    width: 100% !important;
    flex: 0 0 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
  }

  .banner-img {
    margin: 0 !important;
    padding: 0 4px !important;
    overflow: hidden;
  }

  .banner-img img,
  .banner-img .img-fluid,
  .banner-img .headerimg,
  .banner-img .header2img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: 60px !important;
    object-fit: cover !important;
    border-radius: 6px !important;
    display: block !important;
  }

  /* Hide second header ad row on mobile to save space */
  .header-middle .row:nth-child(2) {
    display: none !important;
  }

  /* ======================================
     NAVBAR — Streamlined Mobile Menu
     ====================================== */
  .header-default {
    margin-top: 0 !important;
    padding: 0 !important;
    background: var(--g2m-surface) !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 1050 !important;
  }

  .header-nav-item {
    padding: 0 !important;
  }

  .ts-main-menu,
  .main-nav,
  nav.navbar,
  .navigation {
    position: relative !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: var(--g2m-surface) !important;
    border-bottom: 1px solid rgba(0,0,0,0.06) !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  /* Mobile nav header — clean logo + hamburger */
  .nav-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 8px 16px !important;
    background: var(--g2m-surface) !important;
    min-height: 56px !important;
    width: 100% !important;
  }

  /* Hamburger toggle on the Left */
  .nav-toggle {
    width: auto !important;
    min-width: 36px !important;
    height: 36px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    background: transparent !important;
    border-radius: 8px !important;
    cursor: pointer;
    flex: 1;
    position: relative !important;
    left: 0 !important;
    top: 0 !important;
  }

  .nav-toggle::before {
    content: "\f0c9" !important;
    font-family: "FontAwesome" !important;
    font-size: 1.5rem !important;
    color: var(--g2m-primary) !important;
  }

  /* Logo in the Middle */
  .nav-header .nav-brand {
    display: flex !important;
    justify-content: center !important;
    flex: 1;
  }

  .nav-header .nav-brand img,
  .mobile-logo img {
    max-height: 48px !important;
    width: auto !important;
    padding: 4px 0 !important;
  }

  /* Search & Login on the Right */
  .mobile-header-actions {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 12px !important;
    flex: 1;
  }

  /* Prevent Flash of Unhidden Menu (FOUC) on page load before JS initializes */
  nav.navigation:not(.navigation-portrait) .nav-menus-wrapper {
    display: none !important;
  }

  .mobile-search-icon {
    color: var(--g2m-text) !important;
    font-size: 1.1rem !important;
  }

  .mobile-login-btn {
    background: var(--g2m-accent) !important;
    color: #fff !important;
    font-weight: 600 !important;
    font-size: 0.8rem !important;
    padding: 6px 14px !important;
    border-radius: var(--radius-pill) !important;
    text-transform: none !important;
    box-shadow: 0 2px 8px rgba(233,69,96,0.3) !important;
  }

  /* Mobile dropdown menu — clean full width */
  .nav-menus-wrapper {
    background: var(--g2m-surface) !important;
    box-shadow: 0 16px 40px rgba(0,0,0,0.12) !important;
    border-radius: 0 0 var(--radius-md) var(--radius-md) !important;
    padding-bottom: 12px !important;
  }

  /* Main Links Group on Mobile */
  .nav-menu {
    display: flex !important;
    flex-direction: column !important;
    padding: 8px 12px !important;
    margin: 0 !important;
  }

  .nav-menu > li {
    display: block !important;
    float: none !important;
  }

  .nav-menu > li > a {
    padding: 12px 16px !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    font-family: var(--font-primary) !important;
    color: var(--g2m-text) !important;
    border-bottom: 1px solid rgba(0,0,0,0.04) !important;
    text-transform: capitalize !important;
    display: block !important;
    background: transparent !important;
  }

  .nav-menu > li > a:hover,
  .nav-menu > li.active > a {
    color: var(--g2m-accent) !important;
    background: var(--g2m-surface-alt) !important;
  }

  .nav-menu > li > a > i.fa-home {
    font-size: 1.1rem !important;
    color: inherit !important; /* Inherit the hover/active color */
  }
  
  .nav-menu > li:not(.active) > a > i.fa-home {
      color: var(--g2m-accent) !important;
  }

  /* Hide the redundant Search & Login from the dropdown since they are in the header now */
  .nav-menus-wrapper .right-menu {
    display: none !important;
  }

  /* ======================================
     ADVERTISEMENT TICKER
     ====================================== */
  .adv-ticker-section {
    padding: 4px 0 !important;
  }

  .adv-ticker-box {
    border-radius: 6px !important;
    margin: 0 4px !important;
  }

  .adv-ticker-wrapper {
    padding: 6px 0 !important;
  }

  .adv-item {
    font-size: 13px !important;
    font-weight: 700 !important;
    margin-right: 40px !important;
  }

  /* ======================================
     BREAKING NEWS — Compact & Clean
     ====================================== */
  .ts-breaking-news {
    flex-direction: column !important;
    display: flex !important;
    gap: 0 !important;
    border-radius: var(--radius-sm) !important;
    overflow: hidden !important;
    margin-bottom: 12px !important;
  }

  .breaking-title {
    font-size: 0.75rem !important;
    padding: 8px 12px !important;
    white-space: nowrap !important;
    float: none !important;
    width: 100% !important;
    text-align: center !important;
    margin: 0 !important;
  }

  .breaking-news-content {
    float: none !important;
    width: 100% !important;
    padding: 0 12px !important;
  }

  .breaking-news-content p,
  .breaking-post-content p {
    font-size: 0.82rem !important;
    line-height: 1.4 !important;
    padding: 6px 0 !important;
  }

  /* Date picker search — compact */
  .post-search-datepicker {
    padding: 6px 12px 10px !important;
    width: 100% !important;
    float: none !important;
  }

  .post-search-datepicker .form-control {
    font-size: 0.82rem !important;
    padding: 8px 14px !important;
    border-radius: var(--radius-sm) !important;
    border: 1px solid rgba(0,0,0,0.1) !important;
  }

  /* ======================================
     CONTENT SECTIONS — Mobile Feed Style
     ====================================== */

  /* Section titles */
  .ts-title, h2.ts-title {
    font-size: 1.1rem !important;
    margin-bottom: 14px !important;
    padding-bottom: 8px !important;
  }

  .ts-title::after {
    width: 32px !important;
    height: 3px !important;
  }

  /* Container padding — handled at top of media query */

  /* NEWS CARDS — Horizontal layout handled in global resets at top of file */

  .top-news:hover,
  .g2m-card:hover {
    transform: none !important;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06) !important;
  }

  /* ======================================
     HERO / SLIDER — Full Width Mobile
     ====================================== */
  .g2m-hero-wrapper,
  .ts-overlay-style {
    border-radius: var(--radius-sm) !important;
    margin: 0 !important;
    overflow: hidden !important;
  }

  .g2m-hero-wrapper .post-title.lg a,
  .ts-overlay-style .post-title.lg a {
    font-size: 0.95rem !important;
    line-height: 1.3 !important;
  }

  .g2m-hero-wrapper .overlay-post-content,
  .ts-overlay-style .overlay-post-content {
    padding: 20px 14px 14px !important;
  }

  /* Slider arrows on mobile */
  .owl-nav .owl-prev,
  .owl-nav .owl-next {
    width: 28px !important;
    height: 28px !important;
    font-size: 0.7rem !important;
  }

  /* Category pill badges on slider */
  .post-cat,
  a.post-cat {
    font-size: 0.6rem !important;
    padding: 3px 10px !important;
  }

  /* ======================================
     GRID CONTENT (Category Boxes)
     ====================================== */
  .ts-grid-box {
    margin-bottom: 12px !important;
  }

  .ts-grid-content {
    margin-bottom: 10px !important;
    border-radius: var(--radius-sm) !important;
  }

  .ts-grid-content:hover {
    transform: none !important;
  }

  .ts-grid-content .ts-post-thumb img {
    width: 100% !important;
    height: auto !important;
    min-height: 120px !important;
    object-fit: cover !important;
  }

  /* ======================================
     FEATURED SECTION
     ====================================== */
  .g2m-featured-section {
    padding: 12px !important;
    border-radius: var(--radius-sm) !important;
  }

  /* ======================================
     SIDEBAR — Stacked Below Content
     ====================================== */
  .right-sidebar {
    margin-top: 20px;
    position: static !important;
  }

  .widgets {
    padding: 14px !important;
    border-radius: var(--radius-sm) !important;
    margin-bottom: 12px !important;
  }

  /* ======================================
     FOOTER — Compact Mobile Footer
     ====================================== */
  .ts-footer {
    padding: 28px 0 14px !important;
  }

  .ts-footer h2 {
    font-size: 0.92rem !important;
    margin-bottom: 12px !important;
  }

  .ts-footer p,
  .ts-footer li,
  .ts-footer a {
    font-size: 0.8rem !important;
  }

  .ts-footer .col-lg-3,
  .ts-footer .col-lg-2 {
    margin-bottom: 16px !important;
  }

  .copyright {
    font-size: 0.7rem !important;
    padding: 10px 12px !important;
  }

  /* Social icons compact */
  .b-sm-icon ul li a {
    width: 34px !important;
    height: 34px !important;
    font-size: 0.8rem !important;
  }

  /* ======================================
     AD CONTAINERS — Responsive
     ====================================== */
  .add2 {
    border-radius: var(--radius-sm) !important;
    margin-bottom: 10px !important;
    overflow: hidden !important;
  }

  .add2 img {
    width: 100% !important;
    height: auto !important;
    max-height: 80px !important;
    object-fit: cover !important;
    border-radius: var(--radius-sm) !important;
  }

  /* ======================================
     MISC MOBILE FIXES
     ====================================== */

  /* Hide scroll-top button on mobile (bottom nav handles it) */
  .scrollTop {
    display: none !important;
  }

  /* Visitor counter */
  .count {
    font-size: 0.72rem !important;
    padding: 6px 0 !important;
  }

  /* Tab nav — scrollable on mobile */
  .nav-tabs {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px !important;
  }

  .nav-tabs::-webkit-scrollbar {
    display: none;
  }

  .nav-tabs .nav-link,
  .nav-tabs li a {
    white-space: nowrap !important;
    font-size: 0.78rem !important;
    padding: 8px 14px !important;
  }

  /* Highlight boxes */
  .heighlight {
    margin-bottom: 10px !important;
    border-radius: var(--radius-sm) !important;
  }

  .heighlight:hover {
    transform: none !important;
  }

  /* Videos on mobile */
  .video-row {
    flex-direction: column !important;
    gap: 8px;
  }

  .video-left {
    width: 100% !important;
    flex: 0 0 auto !important;
  }

  .video-left iframe {
    width: 100% !important;
    height: 200px !important;
    border-radius: var(--radius-sm) !important;
  }

  .video-right {
    padding-left: 0 !important;
  }

  .video-right h6 {
    font-size: 0.88rem !important;
    line-height: 1.35 !important;
  }

  .video-right p {
    font-size: 0.8rem !important;
    line-height: 1.4 !important;
  }

  /* Disable AOS on mobile for performance */
  [data-aos] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  /* Row gutter fix */
  .row {
    margin-left: -6px !important;
    margin-right: -6px !important;
  }

  .row > [class*="col-"] {
    padding-left: 6px !important;
    padding-right: 6px !important;
  }

  /* Prevent content from overflowing */
  img {
    max-width: 100%;
    height: auto;
  }

  /* Form inputs on mobile */
  .form-control,
  .form-select {
    font-size: 0.85rem !important;
    padding: 8px 12px !important;
    border-radius: var(--radius-sm) !important;
  }
}

/* ==========================================
   SMALL PHONES (≤ 375px)
   ========================================== */
@media (max-width: 375px) {
  .g2m-bnav-item {
    font-size: 0.55rem;
    padding: 4px 8px;
    min-width: 44px;
  }

  .g2m-bnav-item i {
    font-size: 1.05rem;
  }

  .p-cat-desc h3,
  .g2m-card .p-cat-desc h3 {
    font-size: 0.85rem !important;
  }

  .ts-title, h2.ts-title {
    font-size: 1rem !important;
  }

  .breaking-title {
    font-size: 0.7rem !important;
  }

  .header-middle .logo img,
  .logo img {
    max-height: 34px !important;
  }
}

/* ==========================================
   TABLET (769px - 1024px)
   ========================================== */
@media (min-width: 769px) and (max-width: 1024px) {
  .g2m-bottom-nav {
    display: none !important;
  }

  .header-middle .logo img {
    max-height: 50px !important;
  }

  .banner-img img {
    max-height: 80px !important;
  }
}
