/* ==========================================================================
   PRODUCTS PAGE LAYOUT & STYLING
   PRODUCTS PAGE LAYOUT & Styling
   Matches the design screenshot layout closely.
   ========================================================================== */

/* Page Background Overrides */
.products-page {
  background-color: #fafbfc;
}

/* Ensure global background doesn't block interactions */
.products-page #bg-placeholder {
  pointer-events: none;
}

/* ==========================================================================
   PRODUCTS HERO SECTION
   ========================================================================== */
.products-hero {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.products-hero-bg {
  width: 100%;
  height: auto;
  display: block;
}

.products-hero-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  width: 90%;
  max-width: 900px;
  z-index: 2;
}

.products-hero-title {
  font-size: 56px;
  font-weight: 700;
  color: #000000;
  margin-bottom: 20px;
}

.products-hero-desc {
  font-size: 20px;
  color: #000000;
  line-height: 1.6;
}

@media (max-width: 768px) {
  .products-hero {
    min-height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .products-hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .products-hero-title {
    font-size: 28px;
    margin-bottom: 10px;
  }

  .products-hero-desc {
    font-size: 14px;
    line-height: 1.5;
  }
}

/* Layout Container */
.products-layout-container {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 50px;
  max-width: 1600px;
  margin-top: 90px;
  margin-bottom: 90px;
  padding: 0 50px;
  position: relative;
  z-index: 5;
  color: #1c1c1c;
}

/* ==========================================================================
   SIDEBAR
   ========================================================================== */
.products-sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 120px;
  /* Space for the site header */
  align-self: start;
  height: calc(100vh - 140px);
  overflow-y: auto;
  overflow-x: hidden;
  /* Hide scrollbar for a cleaner look but keep functionality */
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.1) transparent;
}

.products-sidebar::-webkit-scrollbar {
  width: 4px;
}

.products-sidebar::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}

.sidebar-header {
  margin-bottom: 10px;
}

.sidebar-title {
  font-size: 14px;
  font-weight: 700;
  background: linear-gradient(90deg, var(--clr-primary-dark) 0%, #29A4E2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-dash {
  width: 16px;
  height: 2px;
  background-color: var(--clr-primary);
  display: inline-block;
}

/* Category List */
.category-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.category-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  background-color: transparent;
  color: #4a5568;
  font-weight: 600;
  font-size: 13px;
}

.category-item-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.category-icon {
  font-size: 20px;
  opacity: 0.7;
}

.category-number {
  font-size: 14px;
  opacity: 0.5;
  font-family: monospace;
}

.category-name {
  white-space: normal;
  line-height: 1.3;
}

.category-item:hover {
  background-color: rgba(11, 94, 215, 0.05);
  background: linear-gradient(90deg, var(--clr-primary-dark) 0%, #29A4E2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.category-item.active {
  background: linear-gradient(90deg, var(--clr-primary-dark) 0%, #29A4E2 100%);
  color: #ffffff;
  -webkit-text-fill-color: initial;
  box-shadow: 0 4px 15px rgba(11, 94, 215, 0.3);
}

.category-item.active .category-icon,
.category-item.active .category-number {
  opacity: 1;
}

/* Need Help Card */
.help-card {
  margin-top: auto;
  /* Push to bottom if sidebar is tall */
  background-color: #f0f4f8;
  border-radius: 16px;
  padding: 24px;
  text-align: left;
}

.help-card h4 {
  color: var(--clr-primary);
  font-size: 16px;
  margin-bottom: 8px;
  font-weight: 700;
}

.help-card p {
  font-size: 13px;
  color: #4a5568;
  margin-bottom: 20px;
  line-height: 1.5;
}

.btn-help {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: #ffffff;
  color: var(--clr-primary);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid #e2e8f0;
  transition: all 0.2s ease;
}

.btn-help:hover {
  background-color: var(--clr-primary);
  color: #ffffff;
}

/* ==========================================================================
   MAIN CONTENT AREA
   ========================================================================== */
.products-main {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

/* Toolbar */
.products-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.breadcrumb {
  font-size: 12px;
  font-weight: 700;
  background: linear-gradient(90deg, var(--clr-primary-dark) 0%, #29A4E2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0;
}

.search-box {
  position: relative;
  width: 300px;
}

.search-box input {
  width: 100%;
  padding: 14px 24px;
  padding-right: 50px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  outline: none;
  font-size: 16px;
  transition: border-color 0.2s ease;
  background-color: #ffffff;
}

.search-box input:focus {
  border-color: #29A4E2;
}

.search-box i {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: #a0aec0;
  font-size: 18px;
}

/* Category Header */
.category-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 10px;
}

.category-info h1 {
  font-size: 36px;
  font-weight: 700;
  color: #1a202c;
  margin-bottom: 20px;
}

.category-info p {
  color: #718096;
  max-width: 600px;
  font-size: 16px;
  line-height: 1.6;
}

.category-controls {
  display: flex;
  align-items: center;
  gap: 20px;
}

.view-toggles {
  display: flex;
  gap: 5px;
}

.view-btn {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a0aec0;
  cursor: pointer;
  transition: all 0.2s ease;
}

.view-btn.active,
.view-btn:hover {
  border-color: var(--clr-primary);
  color: var(--clr-primary);
  background-color: rgba(11, 94, 215, 0.05);
}

.sort-dropdown {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  padding: 8px 15px;
  border-radius: 8px;
}

.sort-label {
  font-size: 13px;
  color: #718096;
}

.sort-dropdown select {
  border: none;
  outline: none;
  font-size: 14px;
  font-weight: 600;
  color: #1a202c;
  background: transparent;
  cursor: pointer;
}

/* ==========================================================================
   PRODUCT CARDS GRID
   ========================================================================== */
.products-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 30px;
  /* Fade-in animation class applied by JS */
}

.products-grid.animating {
  animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Product Card */
.p-card {
  background-color: #ffffff;
  border: 1px solid #f0f0f0;
  border-radius: 20px;
  padding: 30px;
  position: relative;
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.02);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.p-card:hover {
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.06);
  transform: translateY(-5px);
}

.p-card-bookmark {
  position: absolute;
  top: 25px;
  right: 25px;
  color: #a0aec0;
  font-size: 18px;
  cursor: pointer;
  transition: color 0.2s ease;
  z-index: 2;
}

.p-card-bookmark:hover {
  color: var(--clr-primary);
}

.p-card-image-area {
  position: relative;
  height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 30px;
}

/* Subtle background rings behind product */
.p-card-image-bg {
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 1px solid #f0f4f8;
  background: radial-gradient(circle, #f8fafc 0%, transparent 70%);
  z-index: 0;
}

.p-card-image-area img {
  max-height: 90%;
  max-width: 150%;
  object-fit: contain;
  position: relative;
  z-index: 1;
  transition: transform 0.4s ease;
}

.p-card:hover .p-card-image-area img {
  transform: scale(1.05);
}

.p-card-bottom {
  margin-top: auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

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

.p-card-badge {
  background: linear-gradient(90deg, var(--clr-primary-dark) 0%, #29A4E2 100%);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 6px;
}

.p-card-title {
  font-size: 20px;
  font-weight: 600;
  color: #1a202c;
  margin: 0;
}

.p-card-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid #e2e8f0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4a5568;
  cursor: pointer;
  transition: all 0.2s ease;
}

.p-card-btn:hover {
  background: linear-gradient(90deg, var(--clr-primary-dark) 0%, #29A4E2 100%);
  border-color: transparent;
  color: #ffffff;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 1024px) {
  .products-layout-container {
    grid-template-columns: 1fr;
    gap: 30px;
    padding: 0 24px;
    margin-top: 40px;
    margin-bottom: 60px;
  }

  .products-sidebar {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 10px;
    position: relative;
    top: 0;
    height: auto;
    width: 100%;
  }

  .sidebar-header {
    display: none;
  }

  .category-list {
    flex-direction: row;
    gap: 10px;
    white-space: nowrap;
    width: 100%;
  }

  .category-item {
    padding: 10px 18px;
    white-space: nowrap;
    border-radius: 25px;
    background-color: #edf2f7;
    flex-shrink: 0;
  }

  .category-item.active {
    background: linear-gradient(90deg, var(--clr-primary-dark) 0%, #29A4E2 100%);
    color: #ffffff;
  }

  .help-card {
    display: none;
  }

  .category-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

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

@media (max-width: 768px) {
  .products-layout-container {
    padding: 0 15px;
    margin-top: 25px;
  }

  .products-hero-content {
    padding: 0 15px;
  }

  .products-hero-title {
    font-size: 26px;
    margin-bottom: 12px;
  }

  .products-hero-desc {
    font-size: 14px;
    line-height: 1.5;
  }

  .products-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .search-box {
    width: 100%;
  }

  .category-info h1 {
    font-size: 26px;
    margin-bottom: 8px;
  }

  .category-info p {
    font-size: 14px;
  }

  .p-card {
    padding: 18px 14px;
    border-radius: 14px;
  }

  .p-card-image-area {
    height: 170px;
    margin-bottom: 15px;
  }

  .p-card-title {
    font-size: 16px;
  }

  .p-card-badge {
    font-size: 12px;
    padding: 4px 8px;
  }
}

@media (max-width: 480px) {
  .products-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}