/* home_page.css */

/* Basic reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Page background */
body {
  font-family: Arial, sans-serif;
  background-color: #fcfcfc;
  color: #333;
  padding-top: 60px; /* to avoid overlap with a fixed header if any */
}

/* Default margin on desktop for main content */
main {
  margin: 20px 12%;
  padding: 0px 0;
}

/* ================================
   TOP ROW (Desktop & Mobile)
================================ */
.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.category-name {
  font-size: 24px;
  flex-shrink: 0;
  margin-top: 0; /* on desktop, it's fine to stay as is */
}

/* Mobile-only Filtrele + Sıralama row, hidden on desktop */
.mobile-buttons-row {
  display: none;
  align-items: center;
}

.vertical-line {
  width: 1px;
  height: 28px;
  background-color: #fff;
  margin: 0 8px;
}

.red-btn {
  background-color: red;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 15px;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.3s ease;
}
.red-btn:hover {
  background-color: darkred;
}

/* Search container: Desktop => narrower, Mobile => full width in media query */
.search-container {
  display: flex;
  align-items: center;
}

#search-input {
  width: 350px;
  max-width: 100%;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 5px;
  margin-right: 8px;
}
#search-btn {
  background-color: red;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 15px;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.3s ease;
}
#search-btn:hover {
  background-color: darkred;
}

/* SORTING PANEL (Desktop => inline, Mobile => bottom sheet) */
.sort-panel {
  display: flex;
  align-items: center;
  gap: 8px;

  /* Desktop default: position static, visible */
  position: static;
  transform: none;
  box-shadow: none;
  border: none;
  z-index: auto;
}

.sort-label {
  font-weight: bold;
}
#sorting-select {
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 5px;
}

.close-sort-btn {
  display: none;
  margin-bottom: 10px;
  background-color: #dc3545;
  color: #fff;
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9em;
}

/* ================================
   MAIN CONTENT: Filters + Products
================================ */
.main-content {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 20px 0;
  border-radius: 8px;
  background-color: #FCFCFC;
}

/* ================================
   FILTERS: Desktop => left sidebar
            Mobile => bottom sheet
================================ */
.filters {
  background-color: #FCFCFC;
  padding: 20px;
  border-radius: 8px;
  /* z-index: 99999; */

  /* Mobile bottom sheet (see media query) */
  position: fixed;
  left: 0; 
  right: 0;
  bottom: 0;
  width: 100%;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  /* z-index: 9999; */
  max-height: 70vh;
  overflow-y: auto;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
  border-top: 2px solid #ddd;
}
.filters.show {
  transform: translateY(0);
}

.close-filter-btn {
  display: none; /* hidden on desktop */
  margin-bottom: 10px;
  background-color: #dc3545;
  color: #fff;
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9em;
}

/* Desktop => static left sidebar */
@media (min-width: 769px) {
  .filters {
    position: static;
    /* background-color: #dc3545; */
    transform: none;
    max-height: none;
    overflow: visible;
    box-shadow: none;
    border-top: none;
    flex: 0 0 220px; 
  }
  .close-filter-btn {
    display: none !important;
  }
}

/* Clear filters button */
#clear-filters-btn {
  background-color: #f44336;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 5px;
  cursor: pointer;
  margin-bottom: 15px;
  transition: background-color 0.3s ease;
}
#clear-filters-btn:hover {
  background-color: #d32f2f;
}

.filter-group {
  margin-bottom: 20px;
}
.filter-group h4 {
  font-size: 18px;
  margin-bottom: 10px;
}
.filter-options {
  display: flex;
  flex-direction: column;
}
.filter-options label {
  font-size: 16px;
  margin: 5px 0;
}
.filter-options input[type="checkbox"] {
  margin-right: 10px;
}

/* ================================
   PRODUCTS GRID
================================ */
/* Force EXACTLY 3 columns on desktop for bigger cards */
.products {
  display: grid;
  gap: 20px;
  flex: 1;
}

/* By default, let's do 3 columns for screens >= 769px */
@media (min-width: 769px) {
  .products {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* 
  The product card styling
*/
.product {
  background-color: white;
  padding: 10px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.product:hover {
  transform: translateY(-3px);
  box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

.card-content {
  display: flex;
  flex-direction: column;
}

.image-container {
  width: 100%;
  aspect-ratio: 1 / 1;
  position: relative;
  overflow: hidden;
  border-radius: 8px;
}
.image-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.product h3 {
  font-size: 16px;
  margin: 10px 0 5px;
}
.product p {
  font-size: 14px;
  color: #555;
}

.fake-price {
  text-decoration: line-through;
  color: #999;
  margin-right: 8px;
}
.actual-price {
  color: red;
  font-weight: bold;
}

/* Add-to-cart button */
.product button {
  background-color: red;
  color: white;
  border: none;
  padding: 8px 0;
  border-radius: 15px;
  cursor: pointer;
  margin-top: 10px;
  width: 100%;
  font-size: 14px;
  font-weight: bold;
  transition: background-color 0.3s;
}
.product button:hover {
  background-color: darkred;
}

/* ================================
   MEDIA QUERIES FOR MOBILE
================================ */
@media (max-width: 768px) {
  /* Remove side margins on mobile */
  main {
    margin: 20px 0;
  }

  .top-row {
    display: block;
  }

  .filters {
      z-index: 99999;
  }

  /* Move the category name even closer to the header */
  .category-name {
    margin-top: 0;     /* (already 0 above) */
    margin-bottom: 20px; /* smaller gap below to appear closer */
  }
  

  /* Show the Filtrele + Sıralama row (centered) */
  .mobile-buttons-row {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
  }

  /* Search wide, centered */
  .search-container {
    width: 90%;
    margin: 0 auto 15px;
    max-width: 500px;
    display: flex;
  }
  #search-input {
    flex: 1;
    margin-right: 8px;
  }

  /* Sorting panel => bottom sheet */
  .sort-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 20px;
    background-color: #fff;
    border-top: 2px solid #ddd;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
    max-height: 70vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 9999;
    display: none;
    flex-direction: column; 
    align-items: flex-start; 
    gap: 10px; 
  }
  .sort-panel.show {
    display: flex; 
    transform: translateY(0);
  }
  .close-sort-btn {
    display: block;
  }

  .close-filter-btn {
    display: block;
  }

  /* 2 products per row on mobile for bigger cards */
  .products {
    grid-template-columns: repeat(2, 1fr);
  }
}
