/* ============================================================================
   FLAME STORE - FILTERS
   نظام الفلاتر والبحث
   ============================================================================ */

/* ============= FILTERS CONTAINER ============= */
.filters-container {
  max-width: 1200px;
  margin: 0 auto 32px;
  padding: 0 1rem;
}

.filters-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1C2128;
  padding: 16px 24px;
  border-radius: 12px 12px 0 0;
  border: 2px solid #2D333B;
  border-bottom: none;
  cursor: pointer;
  transition: all 0.3s;
  user-select: none;
}

.filters-header:hover {
  background: #22272E;
}

.filters-header.collapsed {
  border-radius: 12px;
  border-bottom: 2px solid #2D333B;
}

.filters-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 12px;
}

.filters-toggle-icon {
  width: 20px;
  height: 20px;
  fill: var(--text-primary);
  transition: transform 0.3s ease;
}

.filters-header:not(.collapsed) .filters-toggle-icon {
  transform: rotate(90deg);
}

.clear-filters-btn {
  background: transparent;
  color: var(--accent-primary);
  border: 2px solid var(--accent-primary);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.clear-filters-btn:hover {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 46, 99, 0.35);
}

/* ============= ADVANCED FILTERS ============= */
.advanced-filters {
  background: var(--bg-card);
  border-radius: 0 0 12px 12px;
  box-shadow: var(--shadow-md);
  border: 2px solid var(--border-default);
  border-top: none;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.5s ease, opacity 0.3s ease;
}

.advanced-filters.show {
  max-height: 5000px;
  opacity: 1;
}

.filter-section {
  padding: 20px 24px;
  border-bottom: 2px solid var(--border-muted);
}

.filter-section:last-of-type {
  border-bottom: none;
}

.filter-section-title {
  color: var(--text-primary);
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-section-title svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.filter-inputs-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-label {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.2px;
}

.advanced-filters input,
.advanced-filters select {
  padding: 10px 12px;
  border-radius: 6px;
  border: 2px solid var(--border-default);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  font-family: inherit;
}

.advanced-filters input:focus,
.advanced-filters select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(255, 46, 99, 0.1);
  background-color: var(--bg-card);
}

.advanced-filters input::placeholder {
  color: var(--text-muted);
}

.advanced-filters input[type="number"] { width: 120px; }
.advanced-filters input[type="text"] { flex: 1; min-width: 220px; }
.advanced-filters select { min-width: 160px; }

/* ============= SORT OPTIONS ============= */
.sort-options { 
  display: flex; 
  gap: 10px; 
  flex-wrap: wrap;
}

.sort-btn {
  padding: 10px 18px;
  border-radius: 6px;
  border: 2px solid var(--border-default);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.sort-btn:hover {
  background-color: var(--bg-elevated);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  transform: translateY(-1px);
}

.sort-btn.active { 
  background: linear-gradient(135deg, var(--accent-primary), #E6294B);
  border-color: var(--accent-primary);
  color: white;
  box-shadow: 0 2px 8px rgba(230, 57, 70, 0.3);
}

/* ============= ADVANCED TOGGLE ============= */
.advanced-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--bg-secondary);
  cursor: pointer;
  transition: background 0.2s;
  border-top: 2px solid var(--border-muted);
}

.advanced-toggle:hover {
  background: var(--bg-elevated);
}

.advanced-toggle-text {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.advanced-toggle-icon {
  transition: transform 0.3s;
  font-size: 12px;
  color: var(--text-secondary);
}

.advanced-toggle.expanded .advanced-toggle-icon {
  transform: rotate(180deg);
}

.advanced-section {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s ease-in-out;
}

.advanced-section.show {
  max-height: 5000px;
}

/* ============= FILTER ACTIONS ============= */
.filter-actions {
  padding: 18px 24px;
  background: var(--bg-secondary);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  border-top: 2px solid var(--border-muted);
}

.submit-btn { 
  background: linear-gradient(135deg, var(--accent-primary), #E6294B);
  color: white;
  font-weight: 700;
  border: none;
  border-radius: 6px;
  padding: 10px 28px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(230, 57, 70, 0.3);
  font-family: inherit;
}

.submit-btn:hover { 
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(230, 57, 70, 0.4);
}

.reset-btn {
  background: transparent;
  color: var(--text-secondary);
  font-weight: 600;
  border: 2px solid var(--border-default);
  border-radius: 6px;
  padding: 10px 24px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  font-family: inherit;
}

.reset-btn:hover {
  background: var(--hover-overlay);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* ============= 3-TIER FILTER SYSTEM ============= */
/* Filter Form Container */
#filterForm {
  position: relative;
  z-index: 100;
  display: block;
}

/* TIER 1: Always Visible (Primary Filters) */
.filters-tier1 {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 16px;
  margin: 16px auto;
  max-width: 1000px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  animation: slideDown 0.4s ease;
  position: relative;
  z-index: 100;
}

.tier1-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  position: relative;
}

.filter-primary {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-primary-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

.filter-primary-label svg {
  fill: var(--accent-primary);
  opacity: 0.9;
  flex-shrink: 0;
}

.input-primary {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border-default);
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  transition: all 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

.input-primary:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px rgba(255, 46, 99, 0.1);
}

.input-primary::placeholder {
  color: var(--text-muted);
}

/* Price Range */
.filter-price .price-inputs {
  display: flex;
  align-items: center;
  gap: 12px;
}

.input-price {
  flex: 1;
  text-align: center;
}

.price-separator {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 16px;
}

/* Sort Pills */
.sort-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sort-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 9px 15px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-default);
  border-radius: 100px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  white-space: nowrap;
}

.sort-pill svg {
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.sort-pill:hover {
  background: var(--bg-elevated);
  border-color: rgba(255, 46, 99, 0.4);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.sort-pill:hover svg {
  opacity: 1;
}

.sort-pill.active {
  background: linear-gradient(135deg, var(--accent-primary), #E6294B);
  border-color: var(--accent-primary);
  color: white;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(255, 46, 99, 0.3);
}

.sort-pill.active svg {
  opacity: 1;
}

/* Action Buttons */
.filter-actions-tier1 {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.btn-apply-tier1 {
  flex: 2;
  padding: 13px 20px;
  background: linear-gradient(135deg, var(--accent-primary), #E6294B);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px rgba(255, 46, 99, 0.3);
  min-height: 48px;
}

.btn-apply-tier1:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 46, 99, 0.4);
}

.btn-apply-tier1:active {
  transform: translateY(0);
}

.btn-clear-tier1 {
  flex: 1;
  padding: 13px 20px;
  background: transparent;
  color: var(--text-secondary);
  border: 2px solid var(--border-default);
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 48px;
}

.btn-clear-tier1:hover {
  background: var(--bg-card);
  border-color: var(--text-muted);
}

/* Advanced Filters Toggle (Inline) */
.advanced-filters-toggle-inline {
  position: relative;
}

.btn-advanced-toggle {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  width: auto !important;
  max-width: none;
  padding: 9px 14px;
  background: linear-gradient(135deg, rgba(255, 46, 99, 0.05), rgba(230, 41, 75, 0.08));
  border: 1.5px solid rgba(255, 46, 99, 0.2);
  border-radius: 8px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: inherit;
  position: relative;
  overflow: hidden;
}

.btn-advanced-toggle::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 46, 99, 0.1), rgba(230, 41, 75, 0.15));
  opacity: 0;
  transition: opacity 0.25s ease;
}

.btn-advanced-toggle:hover {
  border-color: rgba(255, 46, 99, 0.4);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 46, 99, 0.15);
}

.btn-advanced-toggle:hover::before {
  opacity: 1;
}

.btn-advanced-toggle .filter-icon {
  width: 16px;
  height: 16px;
  fill: var(--accent-primary);
  opacity: 1;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.btn-advanced-toggle:hover .filter-icon {
  transform: translateY(-1px);
  filter: drop-shadow(0 0 6px rgba(255, 46, 99, 0.7));
}

.btn-advanced-toggle.expanded .filter-icon {
  opacity: 1;
  filter: drop-shadow(0 0 5px rgba(255, 46, 99, 0.6));
}

.btn-advanced-toggle .btn-text {
  position: relative;
  z-index: 1;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.btn-advanced-toggle .chevron-icon {
  width: 16px;
  height: 16px;
  fill: var(--text-secondary);
  opacity: 0.8;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.btn-advanced-toggle.expanded {
  background: linear-gradient(135deg, rgba(255, 46, 99, 0.1), rgba(230, 41, 75, 0.15));
  border-color: rgba(255, 46, 99, 0.35);
  box-shadow: 0 2px 8px rgba(255, 46, 99, 0.15);
}

.btn-advanced-toggle:hover .chevron-icon {
  opacity: 1;
  fill: var(--accent-primary);
}

.btn-advanced-toggle.expanded .chevron-icon {
  transform: rotate(180deg);
  opacity: 1;
  fill: var(--accent-primary);
}

.advanced-filters-content {
  display: none;
  opacity: 0;
  position: relative;
  z-index: 50;
}

.advanced-filters-content.expanded {
  display: block;
  opacity: 1;
  margin-top: 14px;
  padding-bottom: 10px;
  max-height: none;
  overflow: visible;
  animation: fadeIn 0.3s ease;
}

/* سكرول بار جميل للفلاتر */
.advanced-filters-content::-webkit-scrollbar {
  width: 6px;
}

.advanced-filters-content::-webkit-scrollbar-track {
  background: transparent;
}

.advanced-filters-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.advanced-filters-content::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

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

.advanced-filters-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255, 46, 99, 0.06);
  border-radius: 10px;
  border: 1px solid rgba(255, 46, 99, 0.12);
}

.advanced-filters-notice span {
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ============= ADVANCED FILTERS GRID (Fortnite, etc.) ============= */
.advanced-filters-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  background: var(--bg-card);
  border-radius: 10px;
  border: 1px solid var(--border-default);
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

.numbers-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

@media (max-width: 640px) {
  .numbers-row {
    grid-template-columns: 1fr;
  }
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
}

.filter-label svg {
  width: 14px;
  height: 14px;
  fill: var(--accent-primary);
  flex-shrink: 0;
}

.filter-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border-default);
  border-radius: 6px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  transition: all 0.2s;
  min-width: 0;
}

.filter-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(255, 46, 99, 0.1);
}

.range-separator {
  color: var(--text-muted);
  font-weight: 600;
}

.filter-radio-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-radio {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 2px solid var(--border-default);
  border-radius: 8px;
  background: var(--bg-secondary);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 13px;
  font-weight: 500;
}

.filter-radio input[type="radio"] {
  margin: 0;
}

.filter-radio:hover {
  border-color: var(--accent-primary);
  background: var(--bg-elevated);
}

.filter-radio input[type="radio"]:checked + span {
  color: var(--accent-primary);
  font-weight: 600;
}

/* ============= RESULTS COUNTER ============= */
.results-counter {
  max-width: 1000px;
  margin: 1.5rem auto 1rem;
  padding: 0 1rem;
  text-align: center;
  position: relative;
  z-index: 50;
}

.results-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  background: rgba(255, 46, 99, 0.08);
  border: 1px solid rgba(255, 46, 99, 0.2);
  border-radius: 100px;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.results-badge-pill strong {
  color: var(--accent-primary);
  font-weight: 700;
}

.results-badge-pill .badge-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-primary);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}


