/* Nút toggle chỉ hiện trên tablet/mobile */
.filter-toggle-btn{ display:none !important; }

/* Mặc định cho laptop trở lên */
.product-filter-container {
  display: flex;
  gap: 10px;
  max-width: 1200px;
  margin: 1rem auto;
}

/* Sidebar cố định */
.filter-sidebar {
  width: 280px;
  background: #f9f9f9;
  padding: 20px;
  border-radius: 10px;
  max-width: 300px;
  max-height: 1400px;
}

/* Danh sách sản phẩm chính */
.product-listing {
  flex: 1;
  min-width: 0;
}

.filter-sidebar__header {
  align-items: center;
}

.filter-sidebar__title {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid #eee;
  padding-bottom: 0.5rem;
  color: #333;
}

.filter-category {
  list-style: none;
  padding-left: 0;
  margin: 0 0 1rem 0;
  max-height: 400px;
  overflow-y: auto;
}

.category-list__item {
  margin-bottom: 0.5rem;
}

.category-list__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.category-list__link {
  color: #333;
  text-decoration: none;
  font-weight: 600;
  flex-grow: 1;
  transition: color 0.3s ease;
}

.category-list__link:hover {
  color: #007bff;
}

.category-list__item.active > .category-list__header > .category-list__link {
  color: #007bff;
  font-weight: 700;
}

.category-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
  color: #333;
}
.category-toggle-btn:hover{
  background: none;
  color: #333;
}
.category-toggle-btn[aria-expanded="true"] .icon-arrow-down {
  transform: rotate(180deg);
}

.category-sublist {
  list-style: none;
  padding-left: 1.25rem;
  margin-top: 0.3rem;
  border-left: 2px solid #eee;
}

.category-sublist__item {
  margin-bottom: 0.4rem;
}

.category-sublist__link {
  color: #555;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.3s ease;
}

.category-sublist__item.active > .category-sublist__link {
  color: #007bff;
  font-weight: 700;
}

.category-sublist__link:hover {
  color: #007bff;
}

.show-more-btn {
  background: none;
  border: none;
  color: #333;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.75rem;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 1rem;
  border: 1px solid #ccc;
}
.show-more-btn:hover {
  background: none;
  color: #333;
}
.show-more-btn .icon-arrow-down {
  display: inline-block;
  transition: transform 0.3s ease;
}

.show-more-btn.expanded .icon-arrow-down {
  transform: rotate(180deg);
}

.filter-form {
  margin-top: 2rem;
}

.filter-form__group {
  margin-bottom: 1rem;
}

.filter-form__label {
  display: block;
  margin-bottom: 0.3rem;
  font-weight: 600;
  color: #444;
}

.filter-form__input {
  width: 100%;
  padding: 0.4rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
  transition: border-color 0.3s ease;
}

.filter-form__input:focus {
  outline: none;
  border-color: #007bff;
}

.filter-form__actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-start;
}

.btn {
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  border: none;
  transition: background-color 0.3s ease;
}

.btn-primary {
  background-color: #007bff;
  color: #fff;
}

.btn-primary:hover {
  background-color: #0056b3;
}

.btn-secondary {
  background-color: #6c757d;
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-secondary:hover {
  background-color: #5a6268;
}

/* Input tìm tuyến tàu */
.post-field-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: #444;
}

.post-input {
  width: 100%;
  padding: 0.45rem 0.75rem;
  font-size: 1rem;
  border: 1.5px solid #ccc;
  border-radius: 6px;
  transition: border-color 0.3s ease;
  box-sizing: border-box;
}

.post-input:focus {
  outline: none;
  border-color: #007BFF;
  box-shadow: 0 0 6px rgba(0,123,255,0.5);
}

/* Gợi ý autocomplete */
.autocomplete-suggestions {
  list-style: none;
  margin: 0.3rem 0 0 0;
  padding: 0;
  max-height: 180px;
  overflow-y: auto;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  font-size: 0.95rem;
  cursor: pointer;
  user-select: none;
}

.autocomplete-suggestions li {
  padding: 0.45rem 0.8rem;
  border-bottom: 1px solid #eee;
}

.autocomplete-suggestions li:hover {
  background-color: #007BFF;
  color: white;
}

/* Checkbox group container dạng lưới 3 cột, cuộn */
#station-checkbox-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  max-height: 250px; /* giới hạn chiều cao */
  overflow-y: auto;
  padding: 5px 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background-color: #fafafa;
  box-sizing: border-box;
}

/* Item checkbox */
.checkbox-item {
  display: flex;
  align-items: center;
}

.checkbox-item label {
  cursor: pointer;
  font-size: 0.95rem;
  color: #333;
}

.checkbox-item input[type="checkbox"] {
  margin-right: 8px;
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #007BFF; /* màu checkbox */
}

/* Text thông báo khi không có ga */
#station-checkbox-group p {
  color: #666;
  font-style: italic;
  padding: 0.5rem 0;
}

/* Button lọc theo giá */
.sort-buttons {
  margin: 16px 5px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}


.sort-buttons form {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.sort-buttons form button {
  background: #f0f0f0;
  border: 1.5px solid #333;
  padding: 8px 18px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  color: #333;
  transition: all 0.3s ease;
  user-select: none;
  font-size: 15px;
}

.sort-buttons form button:hover {
  background: #007bff;
  color: #fff;
  border-color: #007bff;
}

.sort-buttons form button.active {
  background: #0056b3;
  color: white;
  border-color: #0056b3;
  cursor: default;
  box-shadow: 0 4px 8px rgba(0, 86, 179, 0.3);
}

.filter-close-btn {
    display: none;
  }

/* Mặc định ẩn sidebar ở tablet và mobile */
@media (max-width: 1024px) {
  .filter-toggle-btn{
    display: flex !important;    
    align-items: center;
    gap: 8px;
    background: none;
    color: #333;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s ease, box-shadow 0.3s ease;
    user-select: none; 
    border: 1px solid #333;
  }
  .section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
  }

  .product-listing__title {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .filter-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 80%;
    max-width: 320px;
    height: 100%;
    background: #fff;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.2);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 9999;
    overflow-y: auto;
    border-radius: 0;
  }

  .filter-sidebar.open {
    transform: translateX(0);
  }

  /* Overlay mờ phía sau */
  .filter-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
  }

  .filter-overlay.active {
    display: block;
  }
  .section-title {
    margin-bottom: 0;
  }

  .sort-buttons {
    padding-bottom: 10px;
    gap: 10px;
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .sort-buttons form {
    flex-wrap: nowrap;
  }

  .sort-buttons > button,
  .sort-buttons form button {
    padding: 7px 14px;
    font-size: 14px;
    white-space: nowrap;
  }

  .filter-close-btn {
    display: block;
    background: none;
    position: absolute;
    top: 10px;
    right: 15px;
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    z-index: 1001;
    color: #333;
  }
  .filter-close-btn:hover {
    background: none;
  }
}
