/* ==========================================================================
   OVERZONE SHOP - DEDICATED FRONTEND MOBILE & TABLET STYLESHEET (mobile.css)
   Breakpoints Covered: 320px, 360px, 375px, 390px, 414px, 430px, 480px, 768px, 991px
   ========================================================================== */

/* Global Touch & Viewport Base (Mobile & Tablet <= 991px) */
@media screen and (max-width: 991px) {
  *, *::before, *::after {
    box-sizing: border-box;
  }

  html, body {
    max-width: 100vw;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
    padding-bottom: 74px !important; /* Space for Mobile Bottom Dock */
  }

  /* Safe Area Inset Support for iPhone Notch / Dynamic Island */
  body {
    padding-bottom: calc(74px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Universal Fluid Containers */
  .container, 
  .container-fluid, 
  .container-sm, 
  .container-md, 
  .container-lg, 
  .container-xl, 
  .container-xxl {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: clamp(10px, 3vw, 16px) !important;
    padding-right: clamp(10px, 3vw, 16px) !important;
  }

  /* Touch Interaction Standard */
  button, 
  a.btn, 
  .btn, 
  .form-control, 
  .form-select, 
  input[type="text"], 
  input[type="number"], 
  input[type="password"], 
  input[type="email"], 
  select, 
  textarea {
    touch-action: manipulation;
    font-size: 16px; /* Prevents auto-zoom on iOS Safari */
  }

  button, a.btn, .btn {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Mobile Top Navigation Bar */
  .top-navbar {
    padding: 8px 0 !important;
  }

  .top-navbar .container {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .nav-brand-img {
    height: 40px !important;
    max-width: 160px !important;
    object-fit: contain !important;
  }

  /* Mobile Bottom Navigation Dock (5 Items) */
  .mobile-bottom-navbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, #9b111e 0%, #7d0a15 100%);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.28);
    z-index: 1040;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)) 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
  }

  .mobile-bottom-nav-grid {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 600px;
    margin: 0 auto;
  }

  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.72rem;
    font-weight: 500;
    padding: 4px 6px;
    border-radius: 12px;
    transition: all 0.2s ease;
    position: relative;
    min-width: 52px;
    text-align: center;
  }

  .mobile-nav-item i {
    font-size: 1.2rem;
    margin-bottom: 2px;
    transition: transform 0.2s ease;
  }

  .mobile-nav-item:hover, .mobile-nav-item:focus {
    color: #ffffff;
  }

  .mobile-nav-item.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(4px);
  }

  .mobile-nav-badge {
    position: absolute;
    top: 0px;
    right: 8px;
    background: #ef4444;
    color: #ffffff;
    font-size: 0.62rem;
    font-weight: 900;
    border-radius: 10px;
    padding: 1px 4.5px;
    border: 1.5px solid #7d0a15;
    line-height: 1;
  }

  /* Product Catalog Grid & Cards (Store / Games List) */
  .game-accounts-grid, 
  .product-catalog-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) !important;
    gap: 12px !important;
  }

  .item-card, 
  .random-catalog-card {
    border-radius: 16px !important;
    width: 100% !important;
  }

  .item-card-img-wrap, 
  .random-card-img-wrap {
    height: 140px !important;
  }

  .item-card-title {
    font-size: 0.92rem !important;
    line-height: 1.3 !important;
  }

  /* Product Detail View & Image Gallery (games.php) */
  .main-image {
    height: 280px !important;
    max-height: 55vw !important;
  }

  .gallery-nav-btn {
    width: 38px !important;
    height: 38px !important;
    font-size: 1rem !important;
  }

  .gallery-thumb-item {
    width: 72px !important;
    height: 54px !important;
  }

  /* Gameplay Systems (Lucky Box, Lucky Wheel, Roulette Slider in random.php) */
  .lucky-box-view-container, 
  .wheel-view-container, 
  .slider-view-container {
    padding: 20px 14px 28px 14px !important;
    border-radius: 18px !important;
    margin: 10px auto 24px auto !important;
    width: 100% !important;
  }

  .poster-card-wrap {
    max-width: 280px !important;
    margin: 0 auto 16px auto !important;
  }

  .wheel-canvas-container {
    width: clamp(270px, 80vw, 360px) !important;
    height: clamp(270px, 80vw, 360px) !important;
    margin-bottom: 24px !important;
  }

  .wheel-center-spin-hub {
    width: 76px !important;
    height: 76px !important;
    font-size: 1.1rem !important;
  }

  .wheel-pills-wrap {
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .wheel-pill-price, .wheel-pill-balance {
    width: 100% !important;
    justify-content: center !important;
    font-size: 0.88rem !important;
  }

  .slider-hero-banner {
    height: 140px !important;
    margin-bottom: 16px !important;
  }

  .slider-watermark-text {
    font-size: 3rem !important;
  }

  .slider-roulette-viewport {
    height: 150px !important;
  }

  .slider-item-card {
    width: 110px !important;
    min-width: 110px !important;
    height: 120px !important;
    padding: 6px !important;
  }

  .slider-item-thumb {
    width: 60px !important;
    height: 60px !important;
  }

  .slider-center-frame {
    width: 120px !important;
    height: 130px !important;
  }

  /* Modals & Popups on Mobile */
  .modal-dialog {
    margin: 10px auto !important;
    max-width: calc(100vw - 20px) !important;
    width: calc(100vw - 20px) !important;
  }

  .modal-content {
    border-radius: 18px !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
  }

  .modal-header, .modal-footer {
    padding: 12px 16px !important;
  }

  .modal-body {
    padding: 16px 14px !important;
  }

  /* Responsive Tables & Touch Scrolling */
  .table-responsive {
    -webkit-overflow-scrolling: touch !important;
    border-radius: 12px !important;
    margin-bottom: 1rem !important;
  }

  /* Typography Clamp & Headings */
  h1, .h1 { font-size: clamp(1.4rem, 5vw, 1.85rem) !important; }
  h2, .h2 { font-size: clamp(1.25rem, 4.5vw, 1.65rem) !important; }
  h3, .h3 { font-size: clamp(1.15rem, 4vw, 1.45rem) !important; }
  h4, .h4 { font-size: clamp(1.05rem, 3.5vw, 1.25rem) !important; }
  h5, .h5 { font-size: clamp(0.95rem, 3vw, 1.1rem) !important; }
}

/* Specific Adjustments for Small Phones (320px - 390px) */
@media screen and (max-width: 390px) {
  .game-accounts-grid, 
  .product-catalog-grid {
    grid-template-columns: 1fr !important;
  }

  .btn-detail-red, .btn-brand, .btn-spin-hero-red {
    font-size: 0.9rem !important;
    padding: 10px 14px !important;
  }

  .mobile-nav-item {
    font-size: 0.65rem !important;
    min-width: 44px !important;
  }

  .mobile-nav-item i {
    font-size: 1.05rem !important;
  }
}
