/* ==========================================================================
   premium-tabs.css - Persistent Left Sidebar & Filters
   ========================================================================== */

/* Utility */
@media (max-width: 991px) {
  .desktop-only {
    display: none !important;
  }
}

/* --- Layout Wrapper (Sidebar + Grid) --- */
.premium-tabs-layout {
  display: flex;
  gap: var(--space-6);
  align-items: flex-start;
}

/* --- 1. Left Sidebar Tabs (Sticky) --- */
.tabs-nav-wrapper {
  flex: 0 0 120px; /* Fixed width */
  position: sticky;
  top: 100px; /* Sticky distance from top */
  /* Allows the sidebar to scroll internally if there are many categories */
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  /* Hide scrollbar for clean look */
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.tabs-nav-wrapper::-webkit-scrollbar {
  display: none;
}

.tabs-nav-track {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding-bottom: 24px;
}

/* Tab Button */
.tab-btn {
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-align: center;
  padding: 4px;
  transition: all var(--transition-fast);
}

.tab-img-bg {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: #f4f4f4;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid transparent;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.tab-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
  transition: transform 0.3s ease;
}

.tab-text {
  font-size: 0.95rem;
  color: var(--color-text-main);
  line-height: 1.2;
  transition: color 0.3s ease;
}

/* Active State */
.tab-btn.active .tab-img-bg {
  border-color: var(--color-primary);
  background: var(--color-white);
  box-shadow: 0 8px 20px rgba(188, 40, 101, 0.15);
}
.tab-btn.active .tab-img {
  transform: scale(1.15);
}
.tab-btn.active .tab-text {
  color: var(--color-primary-dark);
  font-weight: var(--font-weight-bold);
}
.tab-btn.active, .tab-btn:hover {
  background-color: var(--color-white) !important;
  box-shadow: none !important;
}

/* --- 2. Right Side Content & Filters --- */
.tabs-content-wrapper {
  flex: 1;
  min-width: 0;
}

/* --- Filter Pills --- */
.tab-filters-wrapper {
  display: flex;
  gap: 10px;
  margin-bottom: var(--space-5);
  overflow-x: auto;
  padding-bottom: 8px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.tab-filters-wrapper::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  white-space: nowrap;
  padding: 6px 16px;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: 100px;
  font-size: 0.85rem;
  color: var(--color-text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
  transition: all 0.2s ease;
}

.filter-pill:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.filter-pill.active {
  background: rgba(188, 40, 101, 0.05); /* Very light brand color */
  border-color: var(--color-primary);
  color: var(--color-primary);
  font-weight: var(--font-weight-bold);
}

/* Tiny Veg Icon for Filter */
.veg-icon-tiny {
  width: 10px;
  height: 10px;
  border: 1px solid #14803d;
  position: relative;
  display: inline-block;
  border-radius: 1px;
}
.veg-icon-tiny::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 4px;
  background: #14803d;
  border-radius: 50%;
}

/* --- Content Panes --- */
.tab-pane {
  display: none;
  animation: fadeUp 0.3s ease forwards;
}
.tab-pane.active {
  display: block;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Grid Layout (4 on Desktop) */
.tab-product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-5);
}

/* --- 3. Upgraded Product Card Design --- */
.tab-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(0, 0, 0, 0.04);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast);
}

@media (hover: hover) {
  .tab-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
  }
}

.tab-card-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #f9f9f9;
  overflow: hidden;
}
.tab-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-base);
}
.tab-card:hover .tab-card-img {
  transform: scale(1.05);
}

/* Veg Notch */
.veg-notch {
  position: absolute;
  bottom: 0;
  left: 0;
  background-color: var(--color-white);
  padding: 6px 8px 0px 0px;
  border-top-right-radius: 8px;
  z-index: 3;
}
.veg-icon {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1px solid #14803d;
  border-radius: 2px;
  position: relative;
  background: #fff;
}
.veg-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  background-color: #14803d;
  border-radius: 50%;
}

/* Round Add Button */
.tab-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.1) 0%, transparent 40%);
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 12px;
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: 2;
}
.tab-card:hover .tab-card-overlay {
  opacity: 1;
}

.round-add-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-white);
  color: var(--color-primary);
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  transform: translateY(10px);
  transition: all 0.3s ease;
}
.tab-card:hover .round-add-btn {
  transform: translateY(0);
}
.round-add-btn:hover {
  background: var(--color-primary);
  color: var(--color-white);
  transform: scale(1.1) !important;
}

.tab-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--color-accent-yellow);
  color: var(--color-primary-dark);
  font-size: 0.7rem;
  font-weight: bold;
  padding: 4px 8px;
  border-radius: 4px;
  z-index: 2;
}

/* Card Info */
.tab-card-info {
  padding: 14px;
  display: flex;
  flex-direction: column;
}
.tab-card-cat {
  font-size: 0.75rem;
  color: var(--color-text-light);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.tab-card-title {
  font-size: 1.05rem;
  color: var(--color-text-main);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color var(--transition-fast);
}
.tab-card:hover .tab-card-title {
  color: var(--color-primary);
}

.tab-card-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--color-text-main);
  font-weight: var(--font-weight-bold);
  margin-bottom: 6px;
}
.tab-card-rating i {
  color: #f59e0b;
  font-size: 0.9rem;
}
.rating-count {
  color: var(--color-text-light);
  font-weight: normal;
  margin-left: 2px;
}

.tab-card-pricing {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tab-price-old {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  text-decoration: line-through;
}
.tab-price-new {
  font-size: 1.15rem;
  font-weight: var(--font-weight-bold);
  color: var(--color-primary-dark);
}

/* ==========================================================================
   RESPONSIVE OVERRIDES (MOBILE PERSISTENT LEFT SIDEBAR)
   ========================================================================== */

/* Tablets */
@media (max-width: 991px) {
  .tabs-nav-wrapper {
    flex: 0 0 100px;
  }
  .tab-product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
  }
}

/* Mobile Devices (Under 768px): Strict 2-Column Grid + Left Sidebar */
@media (max-width: 767px) {
  .premium-tabs-layout {
    gap: 10px;
  }

  /* Shrink the Sidebar so products fit */
  .tabs-nav-wrapper {
    flex: 0 0 75px; /* Extremely compact sidebar */
    top: 70px; /* Adjust sticky distance for mobile headers */
    max-height: calc(100vh - 70px);
  }

  .tabs-nav-track {
    gap: 12px;
  }

  .tab-img-bg {
    width: 54px;
    height: 54px;
  }
  .tab-img {
    width: 30px;
    height: 30px;
  }

  /* Wrap text on mobile so it doesn't break out of the 75px width */
  .tab-text {
    font-size: 0.9rem;
    line-height: 1.1;
    white-space: normal;
    word-wrap: break-word;
  }

  /* Shrink Filters */
  .tab-filters-wrapper {
    margin-bottom: 12px;
    gap: 6px;
  }
  .filter-pill {
    padding: 4px 12px;
    font-size: 0.75rem;
  }

  /* Strict 2-Column Grid for Mobile Products */
  .tab-product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px; /* Tight gap to maximize space */
  }

  /* Adjust Mobile Card Sizes */
  .tab-card {
    border-radius: var(--radius-md);
  }

  /* Ensure Quick Add button is always visible on touch */
  .tab-card-overlay {
    opacity: 1;
    padding: 6px;
  }

  .round-add-btn {
    transform: none;
    width: 28px; /* Much smaller add button for tiny cards */
    height: 28px;
    font-size: 0.85rem;
  }

  .tab-card-info {
    padding: 8px 6px;
  }

  .tab-card-title {
    font-size: 0.75rem;
    line-height: 1.2;
    margin-bottom: 4px;
    white-space: normal; /* Allow title to wrap on mobile */
    -webkit-line-clamp: 2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
  }

  /* Adjust Notch for Mobile */
  .veg-notch {
    padding: 4px 5px 0px 0px;
    border-top-right-radius: 6px;
  }
  .veg-icon {
    width: 10px;
    height: 10px;
  }
  .veg-icon::after {
    width: 4px;
    height: 4px;
  }

  /* Shrink Ratings/Pricing */
  .tab-card-rating {
    font-size: 0.65rem;
    margin-bottom: 4px;
    gap: 2px;
  }
  .tab-card-rating i {
    font-size: 0.6rem;
  }
  .rating-count {
    font-size: 0.6rem;
    margin-left: 1px;
  }

  .tab-card-pricing {
    gap: 4px;
    flex-wrap: wrap;
  }
  .tab-price-old {
    font-size: 0.65rem;
  }
  .tab-price-new {
    font-size: 0.85rem;
  }
}
