/* ==========================================================================
   THRIFT STORE — Responsive & Mobile-First Optimizations
   ========================================================================== */

/* ----------------- Tablets & Medium Screens (max 1024px) ----------------- */
@media (max-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }

  .category-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 36px;
  }

  .hero-description {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-cta-group {
    justify-content: center;
  }

  .hero-card-preview {
    max-width: 480px;
    margin: 0 auto;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }

  .admin-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ----------------- Mobile Devices (max 768px) ----------------- */
@media (max-width: 768px) {
  :root {
    --header-height: 60px;
    --topbar-height: 32px;
  }

  body {
    padding-bottom: 64px; /* Space for bottom navigation bar */
  }

  .section {
    padding: 44px 0;
  }

  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .main-nav {
    display: none; /* Controlled via mobile drawer */
  }

  .brand-logo-img {
    height: 38px;
  }

  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .product-info {
    padding: 12px 10px;
  }

  .product-title {
    font-size: 0.82rem;
    margin-bottom: 6px;
  }

  .product-price {
    font-size: 0.95rem;
  }

  .product-measurements-preview {
    display: none; /* Keep compact on mobile */
  }

  .product-modal-grid {
    grid-template-columns: 1fr;
    padding: 20px;
    gap: 20px;
  }

  .checkout-container {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .category-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .insta-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .admin-stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .admin-tabs {
    overflow-x: auto;
    white-space: nowrap;
  }

  .filter-chips-row {
    flex-direction: column;
    align-items: stretch;
  }

  .category-chips, .size-chips {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 6px;
    scrollbar-width: none;
  }

  .category-chips::-webkit-scrollbar, .size-chips::-webkit-scrollbar {
    display: none;
  }

  .filter-selects {
    width: 100%;
  }

  .filter-select {
    flex-grow: 1;
  }
}

/* ----------------- Sticky Mobile Bottom Navigation Bar ----------------- */
.mobile-bottom-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: rgba(10, 10, 10, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-color);
  z-index: 900;
  justify-content: space-around;
  align-items: center;
  padding: 0 10px;
}

@media (max-width: 768px) {
  .mobile-bottom-bar {
    display: flex;
  }
}

.mobile-bottom-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-secondary);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  position: relative;
  padding: 6px 12px;
  transition: color var(--transition-fast);
}

.mobile-bottom-item i, .mobile-bottom-item svg {
  font-size: 1.15rem;
}

.mobile-bottom-item.active {
  color: #fff;
}

.mobile-bottom-item .bottom-badge {
  position: absolute;
  top: 2px;
  right: 14px;
  background: #fff;
  color: #000;
  font-size: 0.6rem;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ----------------- Mobile Slide Drawer Menu ----------------- */
.mobile-nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 80%;
  max-width: 320px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-light);
  z-index: 1200;
  transform: translateX(-100%);
  transition: transform var(--transition-smooth);
  display: flex;
  flex-direction: column;
  padding: 24px;
  box-shadow: var(--shadow-lg);
}

.mobile-nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 1150;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
}

.mobile-nav-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.mobile-nav-backdrop.active .mobile-nav-drawer {
  transform: translateX(0);
}

.mobile-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.mobile-drawer-links {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.mobile-drawer-link {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mobile-drawer-link:hover, .mobile-drawer-link.active {
  color: #fff;
}

.mobile-drawer-footer {
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
  font-size: 0.8rem;
  color: var(--text-muted);
}
