@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap');

body {
  font-family: "Poppins", sans-serif;
  background: #f8f9fa;
  margin: 0;
  color: #333;
  overflow-x: hidden;
  width: 100%;
}

/* ── Browse Page Layout ── */
.browse-page {
  margin-top: 95px;
  display: flex;
  min-height: calc(100vh - 95px);
  background: #fff;
  transition: margin-top 0.2s ease;
}

/* ── Mobile Category Toggle Bar (Hidden on Desktop) ── */
.mobile-cat-bar {
  display: none;
  width: 100%;
  padding: 12px 16px;
  background: #ffffff;
  border-bottom: 1px solid #ebebeb;
  box-sizing: border-box;
}

.mobile-cat-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #f9f9f9;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  color: #222;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.mobile-cat-btn i:first-child {
  font-size: 18px;
  color: #c0392b;
}

.mobile-cat-btn i:last-child {
  font-size: 18px;
  color: #888;
}

.mobile-cat-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  z-index: 1500;
}

.mobile-cat-overlay.open {
  display: block;
}

/* ── Sidebar ── */
.browse-sidebar {
  width: 220px;
  min-width: 200px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid #e8e8e8;
  padding: 20px 0;
  position: sticky;
  top: 95px;
  height: calc(100vh - 95px);
  overflow-y: auto;
}

.browse-sidebar::-webkit-scrollbar {
  width: 4px;
}
.browse-sidebar::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 2px;
}

.sidebar-section {
  padding: 0 0 8px;
}

.sidebar-heading {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #aaa;
  padding: 12px 20px 6px;
}

.sidebar-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 20px;
  font-size: 0.84rem;
  font-weight: 500;
  color: #444;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border-left: 3.5px solid transparent;
}

.sidebar-item:hover {
  background: #fef5f5;
  color: #b93228;
}

.sidebar-item.active-item {
  background: #fdf4f4;
  color: #b93228;
  border-left-color: #b93228;
  font-weight: 700;
}

.sidebar-divider {
  height: 1px;
  background: #f0f0f0;
  margin: 8px 16px;
}

/* ── Main Content Area ── */
.browse-content {
  flex: 1;
  min-width: 0;
  padding: 24px 28px;
  background: #fff;
}

.category-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #111;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.category-title i {
  color: #c0392b;
  font-size: 1.4rem;
}

.category-count {
  font-size: 0.8rem;
  font-weight: 500;
  color: #999;
}

/* ── Controls Row ── */
.browse-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}

.controls-left {
  display: flex;
  gap: 10px;
  align-items: center;
  flex: 1;
  min-width: 260px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 8px 14px;
  flex: 1;
  max-width: 320px;
}

.search-box i {
  color: #888;
  font-size: 16px;
}

.search-box input {
  border: none;
  outline: none;
  font-size: 13.5px;
  width: 100%;
  background: transparent;
  font-family: "Poppins", sans-serif;
}

.sort-select-wrapper {
  position: relative;
}

.sort-select {
  padding: 8px 34px 8px 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
  cursor: pointer;
  font-family: "Poppins", sans-serif;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%23666' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.view-toggle {
  display: flex;
  gap: 4px;
}

.view-btn {
  width: 38px;
  height: 38px;
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  color: #666;
  transition: all 0.15s;
}

.view-btn.active-view {
  background: #c0392b;
  color: #fff;
  border-color: #c0392b;
}

/* ── Product List (List View) ── */
.product-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.product-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: white;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  padding: 16px 20px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.02);
  transition: box-shadow 0.2s, transform 0.15s;
}

.product-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.product-img {
  width: 90px;
  height: 90px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
  border-radius: 8px;
  border: 1px solid #f0f0f0;
}

.product-img img {
  max-width: 80px;
  max-height: 80px;
  object-fit: contain;
}

.product-info {
  flex: 1;
  min-width: 0;
  padding: 0 16px;
}

.product-info h3 {
  font-size: 15px;
  font-weight: 700;
  color: #111;
  margin: 0 0 4px 0;
}

.product-info p {
  font-size: 12.5px;
  color: #666;
  margin: 0;
  line-height: 1.45;
}

.product-right {
  text-align: right;
  min-width: 130px;
  flex-shrink: 0;
}

.product-price {
  font-size: 18px;
  font-weight: 800;
  color: #c0392b;
  margin-bottom: 8px;
}

.btn-view {
  background: #c0392b;
  color: white;
  border: none;
  padding: 8px 22px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-view:hover {
  background: #a93226;
}

/* ── Grid View ── */
.product-list.grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}

.product-list.grid-view .product-card {
  flex-direction: column;
  align-items: stretch;
  text-align: center;
  padding: 16px;
}

.product-list.grid-view .product-img {
  width: 100%;
  height: 140px;
  margin-bottom: 10px;
}

.product-list.grid-view .product-info {
  padding: 0;
  margin-bottom: 12px;
}

.product-list.grid-view .product-right {
  min-width: 100%;
}

/* ── DETAIL MODAL (Desktop & Mobile Fully Visible) ── */
.detail-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.detail-modal-overlay.active {
  display: flex !important;
}

.detail-modal {
  background: #ffffff;
  border-radius: 14px;
  width: 100%;
  max-width: 720px;
  max-height: 88vh;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
}

.detail-modal-header {
  background: #c0392b;
  color: #fff;
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.detail-modal-header-title {
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.detail-close-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}

.detail-modal-body {
  padding: 24px;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  overflow-y: auto;
  box-sizing: border-box;
}

.detail-img-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
  border: 1px solid #f0f0f0;
  border-radius: 10px;
  padding: 16px;
  min-height: 200px;
}

.detail-img-panel img {
  max-width: 100%;
  max-height: 180px;
  object-fit: contain;
}

.detail-info-panel {
  display: flex;
  flex-direction: column;
}

/* ─── Mobile Drawer & Detail Modal Breakpoints ─── */
@media (max-width: 860px) {
  .browse-page {
    flex-direction: column;
    margin-top: 70px;
  }

  .mobile-cat-bar {
    display: block;
    position: sticky;
    top: 70px;
    z-index: 100;
  }

  .browse-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    height: 100vh;
    background: #ffffff;
    box-shadow: 4px 0 24px rgba(0,0,0,0.25);
    z-index: 1600;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  .browse-sidebar.open-drawer {
    transform: translateX(0);
  }

  .sidebar-section { padding: 12px 0 0; }
  .sidebar-heading { display: block; color: #999; }
  .sidebar-list { flex-direction: column; }
  .sidebar-item {
    padding: 12px 20px;
    font-size: 13.5px;
    border-radius: 0;
  }
  .sidebar-item i { display: block; }
  .sidebar-item.active-item {
    background: #fdf4f4;
    color: #b93228;
    border-left: 4px solid #b93228;
  }

  .browse-content { padding: 16px; }
}

@media (max-width: 640px) {
  .browse-page {
    margin-top: 64px;
  }

  .mobile-cat-bar {
    top: 64px;
  }

  /* Stack image and info vertically so all details are visible on mobile */
  .detail-modal-body {
    display: flex !important;
    flex-direction: column !important;
    padding: 16px !important;
    gap: 14px !important;
  }

  .detail-img-panel {
    min-height: 150px !important;
    max-height: 180px !important;
    width: 100% !important;
  }

  .detail-info-panel {
    width: 100% !important;
  }

  .product-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .product-info { padding: 0; }
  .product-right {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }

  .product-price { margin-bottom: 0; }
}