/**
 * Gameosophy - Master Responsive & Mobile Optimization Design System
 * Ensures seamless, polished experience across:
 * - Small Mobile: <= 480px
 * - Mobile: 481px - 767px
 * - Tablet: 768px - 1023px
 * - Desktop: 1024px - 1439px
 * - Ultra-wide / 4K: >= 1440px (up to 2560px)
 */

/* ==========================================================================
   1. GLOBAL VIEWPORT & OVERFLOW CONTAINMENT (Zero Horizontal Scroll)
   ========================================================================== */
html {
  box-sizing: border-box;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  overflow-x: clip !important;
  max-width: 100vw;
}

*, *:before, *:after {
  box-sizing: inherit;
}

body {
  overflow-x: clip !important;
  max-width: 100vw;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  background-color: #f8fafc;
}

.horizontalMenucontainer,
.wrapper,
.page,
.main-content,
.cat-landing-wrapper,
.gm-dashboard-wrapper,
.gm-cart-page {
  max-width: 100vw !important;
  overflow-x: clip !important;
}

/* Fluid Media Handling */
img, video, iframe, embed, object {
  max-width: 100%;
  height: auto;
}

/* 4K & Ultrawide Container Constraint */
@media (min-width: 1440px) {
  .container {
    max-width: 1360px !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }
}

@media (min-width: 1920px) {
  .container {
    max-width: 1440px !important;
  }
}

/* ==========================================================================
   2. TOUCH TARGETS & FORM ACCESSIBILITY (iOS Auto-Zoom Prevention)
   ========================================================================== */
@media (max-width: 767px) {
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="search"],
  input[type="tel"],
  input[type="url"],
  select,
  textarea {
    font-size: 16px !important; /* Prevents iOS Safari from zooming in on focus */
  }

  .btn,
  .nav-link,
  .custom-control-label,
  .gm-wish-btn,
  .gm-social-btn {
    min-height: 40px;
    touch-action: manipulation;
  }
}

/* ==========================================================================
   3. MOBILE HEADER & ACTION CLUSTER (< 992px)
   ========================================================================== */
.horizontal-header {
  background: #121624 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  padding: 10px 0 !important;
  height: auto !important;
  min-height: 60px;
  display: none;
  position: sticky;
  top: 0;
  z-index: 1030;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

@media (max-width: 991px) {
  .horizontal-header {
    display: block !important;
  }

  /* Hide Desktop Topbar Header Search Logo Row to prevent duplication */
  .header-search.header-logosec {
    display: none !important;
  }
}

.gm-mob-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
}

.gm-mob-left-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Animated Hamburger Trigger */
#horizontal-navtoggle {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  padding: 0;
  margin: 0;
  transition: all 0.2s ease;
}

#horizontal-navtoggle:hover,
#horizontal-navtoggle:active {
  background: rgba(99, 102, 241, 0.25);
  border-color: rgba(99, 102, 241, 0.5);
}

#horizontal-navtoggle span {
  display: block;
  position: relative;
  width: 20px;
  height: 2px;
  background: #ffffff;
  transition: all 0.25s ease;
}

#horizontal-navtoggle span::before,
#horizontal-navtoggle span::after {
  content: '';
  position: absolute;
  left: 0;
  width: 20px;
  height: 2px;
  background: #ffffff;
  transition: all 0.25s ease;
}

#horizontal-navtoggle span::before {
  top: -6px;
}

#horizontal-navtoggle span::after {
  bottom: -6px;
}

body.active #horizontal-navtoggle span {
  background: transparent;
}

body.active #horizontal-navtoggle span::before {
  top: 0;
  transform: rotate(45deg);
}

body.active #horizontal-navtoggle span::after {
  bottom: 0;
  transform: rotate(-45deg);
}

/* Mobile Logo */
.gm-mob-logo-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none !important;
}

.gm-mob-logo-link img {
  max-height: 30px;
  width: auto;
  object-fit: contain;
}

/* Mobile Action Cluster */
.gm-mob-actions-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.gm-mob-action-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff !important;
  font-size: 15px;
  text-decoration: none !important;
  transition: all 0.2s ease;
  cursor: pointer;
  padding: 0;
}

.gm-mob-action-btn:hover,
.gm-mob-action-btn:active {
  background: rgba(99, 102, 241, 0.25);
  border-color: rgba(99, 102, 241, 0.5);
  transform: translateY(-1px);
}

.gm-mob-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9999px;
  background: #ef4444;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  border: 1.5px solid #121624;
}

.gm-mob-avatar-wrap {
  width: 100% !important;
  height: 100% !important;
  border-radius: 50% !important;
  overflow: hidden !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: #6366f1;
  position: relative;
}

.gm-mob-avatar-img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: cover !important;
  border-radius: 50% !important;
  display: block !important;
}

.gm-mob-avatar-fallback {
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

/* ==========================================================================
   4. SLIDE-OUT MOBILE NAVIGATION DRAWER (< 992px)
   ========================================================================== */
@media (max-width: 991px) {
  .horizontalMenu {
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    max-width: 85vw;
    height: 100vh !important;
    background: #0f172a !important;
    z-index: 100000;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
  }

  body.active .horizontalMenu {
    transform: translateX(0);
  }

  .horizontal-overlapbg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  body.active .horizontal-overlapbg {
    display: block !important;
    opacity: 1;
  }

  /* Drawer Top User Banner */
  .gm-drawer-user-header {
    padding: 20px 18px;
    background: linear-gradient(135deg, #1e1b4b 0%, #1e293b 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .gm-drawer-user-flex {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .gm-drawer-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #6366f1;
    color: #ffffff;
    font-weight: 700;
  }

  .gm-drawer-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .gm-drawer-user-meta {
    min-width: 0;
    flex: 1;
  }

  .gm-drawer-name {
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 2px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .gm-drawer-email {
    font-size: 12px;
    color: #94a3b8;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .gm-drawer-auth-btns {
    display: flex;
    gap: 8px;
    margin-top: 10px;
  }

  .gm-drawer-btn {
    flex: 1;
    text-align: center;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none !important;
  }

  .gm-drawer-btn-login {
    background: #6366f1;
    color: #ffffff !important;
  }

  .gm-drawer-btn-register {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.2);
  }

  /* Drawer Menu List */
  .horizontalMenu > .horizontalMenu-list {
    list-style: none;
    padding: 10px 0;
    margin: 0;
    flex: 1;
  }

  .horizontalMenu > .horizontalMenu-list > li {
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  }

  .horizontalMenu > .horizontalMenu-list > li > a {
    display: flex;
    align-items: center;
    padding: 13px 20px;
    color: #e2e8f0 !important;
    font-size: 14.5px;
    font-weight: 600;
    text-decoration: none !important;
    transition: background 0.15s ease, color 0.15s ease;
  }

  .horizontalMenu > .horizontalMenu-list > li > a:hover,
  .horizontalMenu > .horizontalMenu-list > li > a:active {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8 !important;
  }

  /* Accordion Submenu Trigger */
  .horizontalMenu-click {
    position: absolute;
    top: 0;
    right: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    cursor: pointer;
    z-index: 2;
  }

  .horizontalMenu-click i {
    transition: transform 0.25s ease;
  }

  .horizontalMenu-click.horizontal-activearrow i {
    transform: rotate(180deg);
    color: #6366f1;
  }

  .horizontalMenu > .horizontalMenu-list > li > .sub-menu {
    display: none;
    list-style: none;
    padding: 0;
    margin: 0;
    background: #090d16;
    border-left: 3px solid #6366f1;
  }

  .horizontalMenu > .horizontalMenu-list > li > .sub-menu > li > a {
    display: block;
    padding: 11px 20px 11px 28px;
    font-size: 13.5px;
    color: #94a3b8 !important;
    text-decoration: none !important;
    transition: all 0.15s ease;
  }

  .horizontalMenu > .horizontalMenu-list > li > .sub-menu > li > a:hover {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.04);
    padding-left: 32px;
  }

  /* Drawer Footer Shortcuts */
  .gm-drawer-footer {
    padding: 16px 20px;
    background: #090d16;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .gm-drawer-social-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #ffffff !important;
    text-decoration: none !important;
  }

  .gm-drawer-wa-btn {
    background: #16a34a;
  }

  .gm-drawer-tg-btn {
    background: #0284c7;
  }
}

/* ==========================================================================
   5. CATALOG & FILTER RESPONSIVE ENHANCEMENTS (`product_with_filter.blade.php`)
   ========================================================================== */
.gm-mobile-filter-bar {
  display: none;
  margin-bottom: 16px;
}

@media (max-width: 991px) {
  .gm-mobile-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: #ffffff;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  }

  .gm-btn-filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #6366f1;
    color: #ffffff !important;
    font-size: 13.5px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease;
  }

  .gm-btn-filter-toggle:hover {
    background: #4f46e5;
  }

  /* Filter Sidebar on Mobile: Collapsible */
  .gm-filter-sidebar-wrapper {
    display: none;
    margin-bottom: 20px;
  }

  .gm-filter-sidebar-wrapper.is-open {
    display: block !important;
    animation: gmFadeIn 0.25s ease;
  }
}

@keyframes gmFadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Catalog Sorting Header Polish */
.item2-gl-nav {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  padding: 14px 18px !important;
  border-radius: 12px !important;
  margin-bottom: 20px !important;
}

@media (max-width: 576px) {
  .item2-gl-nav {
    flex-direction: column !important;
    align-items: flex-start !important;
  }
  .item2-gl-nav .select2-sm {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
  }
}

/* ==========================================================================
   6. PRODUCT DETAIL STICKY BOTTOM BAR & MOBILE POLISH (`detail.blade.php`)
   ========================================================================== */
.gm-mobile-sticky-buy {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12);
  padding: 10px 16px;
  z-index: 1020;
  box-sizing: border-box;
}

@media (max-width: 991px) {
  .gm-mobile-sticky-buy {
    display: block !important;
  }

  /* Add padding bottom to page so content isn't covered by sticky buy bar */
  body.has-sticky-buy {
    padding-bottom: 74px !important;
  }

  .gm-sticky-buy-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    max-width: 600px;
    margin: 0 auto;
  }

  .gm-sticky-price-info {
    display: flex;
    flex-direction: column;
  }

  .gm-sticky-price-label {
    font-size: 11px;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
  }

  .gm-sticky-price-amount {
    font-size: 19px;
    font-weight: 800;
    color: #4f46e5;
    line-height: 1.1;
  }

  .gm-sticky-actions {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .gm-sticky-btn-cart {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 8px;
    background: #f1f5f9;
    color: #0f172a;
    font-size: 13.5px;
    font-weight: 700;
    border: 1px solid #cbd5e1;
    text-decoration: none !important;
  }

  .gm-sticky-btn-buy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: 8px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff !important;
    font-size: 13.5px;
    font-weight: 700;
    border: none;
    text-decoration: none !important;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
  }
}

/* LightGallery & Splide Image Responsiveness */
.marketplace-single-imag {
  width: 100% !important;
  max-width: 100% !important;
}

.marketplace-single-imag .carousel-item img {
  width: 100% !important;
  aspect-ratio: 16/9 !important;
  object-fit: cover !important;
  border-radius: 12px !important;
}

#lightgallery {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
}

#lightgallery img {
  height: 60px !important;
  width: 90px !important;
  object-fit: cover !important;
  border-radius: 8px !important;
  margin: 0 !important;
}

/* ==========================================================================
   7. MODAL, TOAST & DROPDOWN RESPONSIVENESS
   ========================================================================== */
.modal-dialog {
  max-width: 92vw;
  margin: 1.75rem auto;
}

@media (min-width: 576px) {
  .modal-dialog {
    max-width: 500px;
  }
}

@media (min-width: 992px) {
  .modal-lg {
    max-width: 800px;
  }
}

/* Google reCAPTCHA responsive scaling */
.g-recaptcha {
  transform-origin: left top;
  -webkit-transform-origin: left top;
  max-width: 100%;
}

@media (max-width: 360px) {
  .g-recaptcha {
    transform: scale(0.85);
    -webkit-transform: scale(0.85);
  }
}

/* ==========================================================================
   8. CLEAN SPACING & UTILITY POLISH
   ========================================================================== */
@media (max-width: 767px) {
  .sptb {
    padding-top: 35px !important;
    padding-bottom: 35px !important;
  }

  .card-body {
    padding: 16px !important;
  }

  .card-header {
    padding: 14px 16px !important;
  }

  .p-5 {
    padding: 16px !important;
  }
  
  .pl-5, .pr-5 {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  .fs-28 {
    font-size: 22px !important;
  }

  .fs-25 {
    font-size: 20px !important;
  }

  .fs-22 {
    font-size: 18px !important;
  }
}

/* ==========================================================================
   9. GOOGLE AUTH & AUTH FORM RESPONSIVENESS
   ========================================================================== */
.google-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: 46px !important;
  background-color: #4285f4 !important;
  border-radius: 10px !important;
  box-shadow: 0 2px 6px rgba(66, 133, 244, 0.25) !important;
  text-decoration: none !important;
  transition: all 0.2s ease !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.google-btn:hover {
  background-color: #3367d6 !important;
  box-shadow: 0 4px 12px rgba(66, 133, 244, 0.4) !important;
  transform: translateY(-1px);
}

.google-btn .google-icon-wrapper {
  width: 38px !important;
  height: 38px !important;
  border-radius: 8px !important;
  background-color: #ffffff !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin-left: 3px !important;
  flex-shrink: 0 !important;
}

.google-btn .google-icon {
  width: 20px !important;
  height: 20px !important;
}

.google-btn .btn-text {
  flex-grow: 1 !important;
  text-align: center !important;
  color: #ffffff !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  margin: 0 !important;
  padding-right: 38px !important;
}

/* Auth Cards Padding on Mobile */
@media (max-width: 576px) {
  .mt-8 {
    margin-top: 2rem !important;
  }
}

/* ==========================================================================
   10. PAGINATION & BREADCRUMBS RESPONSIVENESS
   ========================================================================== */
.pagination {
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  gap: 4px !important;
  padding: 0 !important;
  margin: 20px 0 !important;
}

.page-item .page-link {
  border-radius: 8px !important;
  min-width: 38px !important;
  height: 38px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 10px !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
  margin: 0 2px !important;
}

.breadcrumb {
  display: flex !important;
  flex-wrap: wrap !important;
  padding: 8px 0 !important;
  margin-bottom: 0 !important;
  background: transparent !important;
}

.breadcrumb-item {
  font-size: 13px !important;
  white-space: nowrap !important;
}

/* ==========================================================================
   11. CONTACT PAGE MEDIA RESPONSIVENESS
   ========================================================================== */
.conatct-list .media {
  display: flex !important;
  align-items: center !important;
  padding: 14px !important;
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 12px !important;
  margin-bottom: 14px !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03) !important;
}

.conatct-list .media-icon {
  width: 46px !important;
  height: 46px !important;
  border-radius: 10px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 18px !important;
  color: #ffffff !important;
  margin-right: 14px !important;
  flex-shrink: 0 !important;
}

