* {
  box-sizing: border-box;
  font-family: Arial, Helvetica, sans-serif;
}

body {
  margin: 0;
  background: #f4f6f8;
}

/* HEADER */

.header {
  background: #0a8f4d;
  color: white;
  padding: 6px 30px;
  font-size: 15px;
  font-weight: bold;
}

/* LAYOUT */

.container-farmaci {
  display: flex;
  min-height: calc(100vh - 60px);
}

.content {
  flex: 1;
  padding: 25px;
}

/* SIDEBAR */

.sidebar-farmaci {
  width: 260px;
  background: white;
  border-right: 1px solid #eee;
  padding: 18px;
  overflow-y: auto;
  position: sticky;
  top: 0;
  max-height: calc(100vh - 60px);
}

.sidebar-farmaci h3 {
  margin: 0 0 15px 0;
  font-size: 18px;
  font-weight: 700;
}

/* Scrollbar */

.sidebar-farmaci::-webkit-scrollbar {
  width: 6px;
}

.sidebar-farmaci::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 10px;
}

.sidebar-farmaci::-webkit-scrollbar-thumb:hover {
  background: #bbb;
}

/* GROUP TITLE */

.group-title {
  padding: 10px 12px;
  font-weight: 600;
  font-size: 14px;
  border-radius: 6px;
  background: #f7f9fb;
  margin-bottom: 5px;
  cursor: pointer;
  position: relative;
  transition: background 0.2s ease;
}

.group-title:hover {
  background: #e8f3ee;
}

.group-title::after {
  content: "▸";
  position: absolute;
  right: 10px;
  transition: transform 0.25s ease;
}

.group-dropdown.open + .group-title::after {
  transform: rotate(90deg);
}

/* GROUP DROPDOWN */

.group-dropdown {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
  padding-left: 6px;
}

.group-dropdown.open {
  max-height: 600px;
}

/* CATEGORY */

.category-label {
  font-size: 13px;
  font-weight: 600;
  color: #666;
  padding: 6px 8px;
  margin-top: 6px;
  cursor: pointer;
  position: relative;
  transition: background 0.2s;
}

/* arrow */
.category-label::after {
  content: "▸";
  position: absolute;
  right: 8px;
  transition: transform 0.25s ease;
}

.category-dropdown.open + .category-label::after {
  transform: rotate(90deg);
}

.category-label.open::after {
  transform: rotate(90deg);
}

.group-title.active {
  background: #0a8f4d;
  color: white;
}

.menu-title.active {
  background: #0a8f4d;
  color: white;
}

.menu-link.active {
  background: #0a8f4d;
  color: white;
}

.category-label.active {
  background: #e8f5ee;
  color: #0a8f4d;
  border-radius: 4px;
}

.category-dropdown {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}

.category-dropdown.open {
  max-height: 500px;
}

/* ARTICLE BUTTON */

.category-farmaci {
  padding: 8px 10px;
  margin: 2px 0;
  border-radius: 5px;
  font-size: 14px;
  cursor: pointer;
  color: #444;
  transition: all 0.15s ease;
}

.category-farmaci:hover {
  background: #eef6f2;
  transform: translateX(3px);
}

.category-farmaci.single.active {
  background: #0a8f4d;
  color: white;
  font-weight: 600;
}

.category-farmaci.active {
  background: #0a8f4d;
  color: white;
  font-weight: 600;
}

/* SINGLE CATEGORY */

.category-farmaci.single {
  margin-top: 6px;
  background: #f1f3f5;
  font-weight: 500;
}

.category-farmaci.single:not(.active):hover {
  background: #e5e9ec;
}

/* PRODUCTS GRID */

.products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

/* PRODUCT CARD */

.product-card {
  background: white;
  border-radius: 10px;
  padding: 15px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease;
  position: relative;
  cursor: pointer;
}

.product-card:hover {
  transform: translateY(-4px);
}

.product-card img {
  width: 100%;
  height: 140px;
  object-fit: contain;
}

/* PRODUCT TEXT */

.product-name {
  font-weight: bold;
  margin: 10px 0 4px;
  word-break: break-word;
}

.product-desc {
  font-size: 14px;
  color: #666;
}

.price {
  margin-top: 8px;
  font-weight: bold;
  color: #0a8f4d;
}

/* STOCK BADGE */

.stock-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 12px;
  font-weight: bold;
  color: white;
  cursor: default;
}

.stock-ok {
  background: #0a8f4d;
}

.stock-low {
  background: #ff9800;
}

.stock-out {
  background: #e53935;
}

/* QUANTITY CONTROLS */

.qty-controls {
  position: absolute;
  bottom: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  background: #f4f6f8;
  border-radius: 20px;
  padding: 4px;
  gap: 6px;
}

.qty-btn {
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: #0a8f4d;
  color: white;
  font-weight: bold;
  cursor: pointer;
}

.qty-btn:hover {
  background: #087a42;
}

.qty-value {
  min-width: 18px;
  text-align: center;
  font-weight: bold;
  font-size: 14px;
}

/* TOOLBAR */

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.view-buttons {
  display: flex;
  gap: 10px;
}

/* LIST VIEW */

.products.list-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.products.list-view .product-card {
  display: flex;
  align-items: center;
  gap: 15px;
}

.products.list-view img {
  width: 100px;
  height: 100px;
}

.products.list-view .product-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.products.list-view .product-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.products.list-view .qty-controls {
  position: static;
}

/* GRID VIEW */

.products.grid-view .product-desc {
  display: none;
}

/* PAGINATION */

.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 25px;
  flex-wrap: wrap;
}

.pagination button {
  padding: 6px 12px;
  border: none;
  background: #e0e0e0;
  border-radius: 5px;
  cursor: pointer;
}

.pagination button:hover {
  background: #0a8f4d;
  color: white;
}

.pagination button.active {
  background: #0a8f4d;
  color: white;
  font-weight: bold;
}

/* FOOTER */

.footer {
  text-align: center;
  padding: 15px;
  background: #eee;
  font-size: 14px;
}

.single-product-view {
  width: 100%;
  padding: 40px;
  box-sizing: border-box;
}

.single-product-top {
  display: flex;
  gap: 50px;
  align-items: flex-start;
}

/* LEFT IMAGE */

.single-product-left {
  flex: 1;
  display: flex;
  justify-content: center;
  width: 100%;
}

.single-product-left img {
  width: 100%;
  max-width: 380px;
  object-fit: contain;
}

/* RIGHT SIDE */

.single-product-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.single-product-right h2 {
  font-size: 26px;
  font-weight: 600;
}

.single-product-price {
  font-size: 28px;
  font-weight: bold;
  color: #1a1a1a;
}

/* QTY CONTROLS */

.qty-controls-single-product {
  display: flex;
  align-items: center;
  border: 1px solid #ccc;
  width: 140px;
}

.qty-controls-single-product button {
  width: 40px;
  height: 40px;
  border: none;
  background: #f4f4f4;
  cursor: pointer;
  font-size: 18px;
}

.qty-controls-single-product span {
  flex: 1;
  text-align: center;
  font-size: 16px;
}

/* ADD CART BUTTON */

.add-cart-btn {
  margin-top: 10px;
  padding: 12px 20px;
  background: #5bb78d;
  border: none;
  color: white;
  font-size: 15px;
  border-radius: 4px;
  cursor: pointer;
  width: 200px;
}

.add-cart-btn:hover {
  background: #48a97e;
}

/* HR */

.single-product-divider {
  margin: 40px 0;
  border: none;
  border-top: 1px solid #ddd;
}

/* DESCRIPTION */

.single-product-description {
  max-width: 900px;
}

.single-product-description h3 {
  margin-bottom: 10px;
}

.single-product-description p {
  line-height: 1.6;
  color: #444;
}

/* ========================= */
/* MOBILE RESPONSIVE */
/* ========================= */

/* MOBILE */

@media (max-width: 768px) {
  .container-farmaci {
    flex-direction: column;
  }

  .sidebar-farmaci {
    display: none;
    /* width: 100%;
    max-height: none;
    overflow-x: auto;
    white-space: nowrap; */
  }

  /* #header_farmaci {
    padding: 20px;
  } */

  #navbar_farmaci_categories {
    display: none;
  }

  .category-farmaci {
    display: inline-block;
    margin-right: 10px;
  }

  .toolbar {
    flex-direction: column;
  }

  #megaPanel {
    display: none !important;
  }

  .single-product-view {
    padding: 20px;
  }

  .single-product-top {
    flex-direction: column;
    gap: 20px;
  }

  .single-product-left img {
    max-width: 260px;
  }

  .single-product-right {
    width: 100%;
  }

  .single-product-right h2 {
    font-size: 20px;
  }

  .single-product-price {
    font-size: 24px;
  }

  .add-cart-btn {
    width: 100%;
  }
}
