/* ============================================
   MOBILE APP TRANSFORMATION - NATIVE UX
   ============================================ */

:root {
  --primary-color: #732d91; /* Milaa Purple */
  --secondary-color: #f7941d; /* Milaa Orange */
}

/* 1. MOBILE FOUNDATION - Typography & Overflow */
@media (max-width: 991px) {
  /* Prevent horizontal scroll */
  html,
  body {
    overflow-x: hidden !important;
    max-width: 100vw;
  }

  body {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding-bottom: 80px; /* Space for bottom nav */
  }

  /* Typography scaling */
  h1 {
    font-size: 18px !important;
    line-height: 1.3;
  }
  h2 {
    font-size: 17px !important;
    line-height: 1.3;
  }
  h3 {
    font-size: 16px !important;
    line-height: 1.3;
  }
  h4,
  h5,
  h6 {
    font-size: 15px !important;
  }
  p {
    font-size: 14px;
    line-height: 1.5;
  }

  /* Container fixes */
  .container,
  .container-fluid {
    padding-left: 15px;
    padding-right: 15px;
    max-width: 100%;
  }

  .row {
    margin-left: -7.5px;
    margin-right: -7.5px;
  }

  .col,
  [class*="col-"] {
    padding-left: 7.5px;
    padding-right: 7.5px;
  }
}

/* 2. TOUCH UX OPTIMIZATIONS */
@media (max-width: 991px) {
  /* Remove tap highlight */
  * {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
  }

  /* Prevent zoom on input focus (iOS) */
  input,
  textarea,
  select {
    font-size: 16px !important;
  }

  /* Touch-friendly buttons */
  button,
  .btn,
  a.btn {
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
  }

  /* Smooth scrolling */
  html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
  }
}

/* 3. MOBILE HEADER - MODERN APP STYLE */
@media (max-width: 991px) {
  .mobile-app-header {
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: #fff;
    z-index: 1020; /* Ensure it's above other content but below modals */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  }

  /* LOGO BACKGROUND - BLACK */
  .mobile-logo {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      background-color: #000; /* Requested Black Background */
      padding: 4px 12px;
      border-radius: 6px;
  }
  
  .mobile-logo img {
      height: 28px !important; /* Slightly smaller to fit in the box */
      object-fit: contain;
  }

  /* Input Styling */
  .mobile-app-header input {
    border-radius: 50px !important; /* Ensure rounded corners */
    background-color: #f3f4f6 !important;
    border: none !important;
    height: 40px !important;
    font-size: 14px !important;
  }
  
  .mobile-app-header input:focus {
    box-shadow: none;
    background-color: #fff !important;
    border: 1px solid #732d91 !important; /* Primary color border on focus */
  }

  /* Body padding to prevent content hiding behind fixed header */
  body {
    padding-top: 115px; /* Adjust for taller header with 2 rows */
  }

  /* Hide desktop header wrapper if explicit hiding is needed */
  .header-main.d-none.d-lg-block {
    display: none !important;
  }
}

/* 4. PRODUCT GRID - 2-COLUMN STRICT - GRID LAYOUT */
@media (max-width: 991px) {
  /* Product Grid Alignment */
  .row.g-4 {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
      margin: 0;
  }
  
  .row.g-4 > [class*="col-"] {
    width: 100% !important;
    max-width: 100% !important;
    flex: unset !important;
    padding: 0 !important;
  }

  /* Force 2-column layout */
  .product-card {
    height: 100%;
    margin-bottom: 0;
    border: none !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
    overflow: hidden; /* Prevent overflow */
  }

  .product-card img {
      max-width: 100%;
      height: auto;
  }

  .product-img-wrapper {
    border-radius: 8px 8px 0 0;
  }

  .product-info {
    padding: 10px 5px !important;
  }

  .product-title {
    font-size: 13px !important;
    height: 38px !important;
    margin-bottom: 5px !important;
  }

  .price-box {
    margin-bottom: 5px !important;
  }

  .new-price {
    font-size: 15px !important;
    font-weight: 700;
    color: var(--primary-color);
  }

  .old-price {
    font-size: 11px !important;
  }

  /* Action Buttons */
  .product-actions .btn {
    padding: 6px 4px !important;
    font-size: 11px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
  }

  .product-actions .btn i {
    font-size: 13px !important;
  }
}

/* 5. FIXED BOTTOM NAVIGATION BAR */
@media (max-width: 991px) {
  .mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #fff;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1040;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    padding-bottom: env(safe-area-inset-bottom); /* iOS Safe Area */
  }

  .mobile-bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-decoration: none;
    color: #999;
    font-size: 10px;
    position: relative;
  }

  .mobile-bottom-nav a i {
    font-size: 20px;
    margin-bottom: 3px;
    color: #999;
  }

  .mobile-bottom-nav a.active {
    color: var(--primary-color);
    font-weight: 600;
  }

  .mobile-bottom-nav a.active i {
    color: var(--primary-color);
  }

  /* Badge for Cart */
  .mobile-nav-badge {
    position: absolute;
    top: 5px;
    right: 25%; /* Center-ish relative to icon */
    background: #f7941d;
    color: white;
    border-radius: 50%;
    padding: 0;
    width: 16px;
    height: 16px;
    font-size: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
  }

  /* WhatsApp Special Color */
  .mobile-bottom-nav a i.fa-whatsapp {
    color: #25d366;
  }

  /* Hide Footer content that might overlap */
  footer {
    padding-bottom: 90px !important;
  }
}

/* Slider Fix for Mobile */
@media (max-width: 991px) {
  .custom-party-slider {
      margin-bottom: 20px;
  }
  
  .custom-party-slider .carousel-item {
    height: auto !important;
    min-height: 350px !important; /* Increased height as requested */
    aspect-ratio: 4/5;
  }

  .custom-party-slider .slider-image-container {
    height: 100%;
    position: relative;
  }

  .custom-party-slider .slider-image-container img {
    height: 100%;
    width: 100%;
    object-fit: cover !important;
  }

  /* Text Overlay with Gradient */
  .custom-party-slider .slider-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 60px 20px 30px 20px; /* More padding top for gradient */
    display: flex;
    flex-direction: column;
    justify-content: flex-end !important;
    align-items: flex-start !important;
    text-align: left !important;
    background: linear-gradient(
      to top,
      rgba(0, 0, 0, 0.9) 0%,
      rgba(0, 0, 0, 0.5) 60%,
      transparent 100%
    );
    pointer-events: none; /* Let clicks pass through to image/buttons if needed, but button needs pointer-events auto */
  }
  
  .custom-party-slider .slider-content * {
      pointer-events: auto;
  }

  .custom-party-slider h1 {
    font-size: 24px !important;
    margin-bottom: 8px !important;
    text-shadow: none; /* Gradient handles readability */
    color: #fff;
    font-weight: 700;
  }
  
  .custom-party-slider p {
      color: rgba(255,255,255,0.9);
      font-size: 14px;
      margin-bottom: 12px;
  }

  .custom-party-slider .btn-slider {
    padding: 10px 25px !important;
    font-size: 14px !important;
    border-radius: 50px;
    background-color: var(--secondary-color);
    border: none;
    color: #fff;
  }
}

/* STORY MODE CATEGORIES - GRID UPDATE */
@media (max-width: 991px) {
  .home-categories-section {
      padding-top: 10px !important;
      padding-bottom: 20px !important;
  }

  .home-categories-section .row {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 15px 10px !important; /* Row gap 15px, Col gap 10px */
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    justify-content: center;
  }

  /* Hide scrollbars not needed anymore */
  .home-categories-section .row::-webkit-scrollbar {
    display: none;
  }

  .home-categories-section .col-6 {
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex;
    justify-content: center;
  }

  .category-icon-card {
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    width: 100%;
    display: flex !important; /* Override d-block */
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
  }

  .category-icon-card .icon-wrapper {
    width: 70px !important; /* Requested 70x70 */
    height: 70px !important;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--primary-color) !important; /* Brand border */
    margin-bottom: 8px;
    padding: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    background-clip: padding-box; /* Ensures border is clean */
  }
  
  /* Gradient border effect optional, but sticking to requested brand color border */

  .category-icon-card .icon-wrapper i {
    font-size: 28px !important;
    color: var(--primary-color);
  }

  .category-icon-card h6 {
    font-size: 12px !important; /* Requested 12px */
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    color: #333;
    font-weight: 500;
  }
}

/* 6. GENERAL SPACING & UTILITIES */
@media (max-width: 991px) {
  .mt-5 {
    margin-top: 30px !important;
  }
  .mb-5 {
    margin-bottom: 30px !important;
  }
  .py-5 {
    padding-top: 30px !important;
    padding-bottom: 30px !important;
  }

  /* Hide desktop-only elements */
  .d-lg-block {
    display: none !important;
  }
}
