/* ─── Mobile / Tablet Adaptation ─────────────────────────────────── */

/* Tablet */
@media (max-width: 1024px) {
  .sidebar { width: 200px; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .two-col { grid-template-columns: 1fr; }
  .home-products-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

/* Mobile */
@media (max-width: 768px) {
  /* Sidebar → hamburger */
  .sidebar {
    display: none !important;
    position: fixed;
    z-index: 150;
    width: 280px;
    height: 100vh;
    top: 0;
    padding-top: 0 !important;
    box-shadow: 4px 0 24px rgba(0,0,0,.5);
  }
  .sidebar.open { display: flex !important; flex-direction: column; }
  .main { margin-left: 0 !important; }

  /* Hamburger button */
  .hamburger {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    flex-shrink: 0;
    padding: 0 8px;
  }
  .hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-sec);
    border-radius: 2px;
  }

  /* Header adjustments */
  .header { padding: 0 12px; gap: 8px; }
  .header__logo { display: none !important; }
  .header__user span:not(.btn) { display: none; }
  .header__user .badge { display: none; }
  .shop-search { max-width: none !important; }

  /* Tables → cards */
  .table-wrap table { display: block; }
  .table-wrap thead { display: none; }
  .table-wrap tbody { display: block; }
  .table-wrap tr {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 8px;
  }
  .table-wrap td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border: none;
  }
  .table-wrap td::before {
    content: attr(data-label);
    color: var(--text-mut);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px;
    min-width: 100px;
  }

  /* Modals — bottom sheet on mobile */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 16px 16px 0 0 !important;
    max-height: 90vh;
  }

  /* Shop grid */
  .product-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .home-products-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .home-reviews-grid { grid-template-columns: 1fr; }

  /* Stats */
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .home-stats { gap: 12px; padding: 14px 16px; }
  .home-stat__divider { display: none; }

  /* Forms */
  .filters { flex-direction: column; }
  .filters .form-control { max-width: 100% !important; }
  .shop-search { order: -1; flex-basis: 100%; }

  /* Two column → single */
  .two-col { grid-template-columns: 1fr !important; }
  .pm-grid  { grid-template-columns: 1fr !important; }
  .api-grid { grid-template-columns: 1fr !important; }

  /* Shop nav */
  .shop-nav__inner { gap: 0; }
  .shop-nav__link  { padding: 8px 10px; font-size: 12px; }

  /* Hero */
  .home-hero { padding: 48px 16px 32px; min-height: auto; }
  .home-hero__title { font-size: 28px !important; }
  .home-hero__sub { font-size: 14px !important; }
  .btn-hero { padding: 10px 18px !important; font-size: 13px !important; }

  /* Page header */
  .page-header { flex-wrap: wrap; gap: 8px; }
  .page-title { font-size: 16px; }
}

/* Small phones */
@media (max-width: 420px) {
  .header { padding: 0 8px; }
  .content { padding: 12px; }
  .card { padding: 14px; }
  .btn { padding: 7px 12px; font-size: 12px; min-height: 40px; }
  .product-grid { grid-template-columns: 1fr; }
  .home-products-grid { grid-template-columns: 1fr; }
  .shop-hero__title { font-size: 22px !important; }
  .home-stat__val { font-size: 20px !important; }
  .geo-card { padding: 28px 16px; }
  .geo-title { font-size: 18px !important; }
}

/* Touch-friendly tap targets */
.btn { min-height: 40px; }
.sidebar__link { min-height: 44px; }
.shop-nav__link { min-height: 40px; }

/* Hamburger is hidden by default */
.hamburger { display: none; }

/* Sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 140;
}
.sidebar-overlay.visible { display: block; }

/* ── Shop mobile menu ─────────────────────────────────────────────── */
#shop-hamburger {
  display: none;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-pri);
}
#shop-mobile-menu {
  display: none;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  width: 280px;
  height: 100vh;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  z-index: 200;
  padding: 20px 0;
  overflow-y: auto;
  box-shadow: 4px 0 24px rgba(0,0,0,.5);
}
#shop-mobile-menu.open { display: flex; }
#shop-menu-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 199;
}
#shop-menu-overlay.visible { display: block; }

@media (max-width: 768px) {
  #shop-hamburger { display: block; }
  .shop-nav { display: none !important; }
  .shop-header__search { max-width: calc(100% - 120px); }
  .shop-header { padding: 0 12px; gap: 8px; }

  /* Tables to cards on mobile in shop */
  .shop-table { display: block; }
  .shop-table thead { display: none; }
  .shop-table tbody { display: block; }
  .shop-table tr {
    display: flex; flex-wrap: wrap;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px; margin-bottom: 8px;
    gap: 6px;
  }
  .shop-table td {
    display: flex;
    justify-content: space-between;
    width: 100%;
    border: none;
    padding: 4px 0;
    font-size: 13px;
  }
  .shop-table td::before {
    content: attr(data-label);
    color: var(--text-mut);
    font-size: 11px;
    min-width: 100px;
  }

  /* Product grid 2 cols on mobile */
  .product-grid { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }

  /* Modals full screen */
  .shop-modal { max-width: 100% !important; width: 100% !important;
    border-radius: 16px 16px 0 0 !important; }
  .modal-overlay { align-items: flex-end !important; }
}

@media (max-width: 420px) {
  .product-grid { grid-template-columns: 1fr !important; }
  .shop-header__logo span { display: none; }
}


/* ─── Sidebar logo on mobile ─────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar-mobile-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px 10px;
    font-size: 15px;
    font-weight: bold;
    color: var(--text-pri);
    border-bottom: 1px solid var(--border);
    margin-bottom: 6px;
  }
}
/* Hidden on desktop */
.sidebar-mobile-logo { display: none; }

.sidebar-body-lock { overflow: hidden !important; }
