/* ═══════════════════════════════════════════════════════════════════════════
   Elyose One-Page Store — Senior UI/UX Polish Sidebar Accordion Styles
   Version: 1.0.14-ui-polished-contrast
   Extends: elyose-store-style-v1.0.10.css
   Theme: Elegant Light, Pure Modern Aesthetics, Warm Highlights
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── 1. Desktop Layout & Main Grid ───────────────────────────────────────── */

/* Override legacy .store grid to ensure clean full-width header + body layout */
.store {
  display: block !important;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 16px;
  box-sizing: border-box;
  direction: rtl;
}

/* Modern 2-Column Desktop Grid for Sidebar + Products */
.store__body {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 28px; /* At least 24px gap between sidebar and products */
  align-items: start;
  min-height: 60vh;
  width: 100%;
}

/* ─── 2. Desktop Accordion Sidebar Container ──────────────────────────────── */

.store__sidebar {
  width: 100%;
  background: #ffffff;
  border: 1px solid #f1f5f9; /* Ultra-soft border */
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.04); /* Soft premium drop shadow */
  padding: 1.25rem 0.75rem;
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
  z-index: 10;
  transition: all 0.3s ease;
  direction: rtl;
  box-sizing: border-box;
}

/* Custom Ultra-thin Scrollbar for Desktop Sidebar */
.store__sidebar::-webkit-scrollbar {
  width: 4px;
}

.store__sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.store__sidebar::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}

.store__sidebar::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ─── 3. 'Back to All Products' Compact Pill Button ───────────────────────── */

.store__sidebar-back-btn:not([hidden]) {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.5rem;
  width: auto !important;
  max-width: max-content !important;
  padding: 6px 14px !important;
  background: #fff8f5 !important;
  border: 1px solid #e65c00 !important;
  border-radius: 50px !important;
  color: #e65c00 !important;
  font-family: inherit;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  cursor: pointer;
  text-align: center;
  direction: rtl;
  white-space: nowrap !important;
  margin-bottom: 0.75rem !important;
  box-shadow: 0 2px 6px rgba(230, 92, 0, 0.08) !important;
  transition: all 0.25s ease !important;
  box-sizing: border-box;
}

.store__sidebar-back-btn[hidden] {
  display: none !important;
}

.store__sidebar-back-btn:hover {
  background: #e65c00 !important;
  color: #ffffff !important;
  border-color: #e65c00 !important;
  box-shadow: 0 4px 12px rgba(230, 92, 0, 0.2) !important;
  transform: translateY(-1px);
}

.store__sidebar-back-btn:focus-visible {
  outline: 2px solid #e65c00;
  outline-offset: 2px;
}

.store__sidebar-back-icon {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  color: inherit;
}

.store__sidebar-back-icon svg {
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  width: 14px;
  height: 14px;
}

/* ─── 4. Desktop Sidebar Category List ────────────────────────────────────── */

.store__sidebar-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.store__sidebar-item {
  position: relative;
  border-radius: 10px;
  transition: all 0.3s ease;
  border: none !important;
}

.store__sidebar-item--dimmed {
  opacity: 0.75;
}

.store__sidebar-item--dimmed:hover {
  opacity: 1;
}

/* ─── 5. Parent Category Button (Desktop Brand Level) ─────────────────────── */

.store__sidebar-brand-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 18px;
  background: transparent;
  border: none !important;
  border-right: 3px solid transparent !important;
  border-left: none !important;
  border-top: none !important;
  border-bottom: none !important;
  border-radius: 8px;
  color: #1a2b4c;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-align: right;
  direction: rtl;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.store__sidebar-brand-btn:hover {
  background-color: #fff8f5;
  color: #e65c00;
}

.store__sidebar-item--active .store__sidebar-brand-btn,
.store__sidebar-brand-btn.active,
.store__sidebar-brand-btn--active {
  background-color: #fff8f5 !important;
  color: #e65c00 !important;
  font-weight: 600 !important;
  border-right: 3px solid #e65c00 !important;
  border-left: none !important;
  border-top: none !important;
  border-bottom: none !important;
  border-radius: 0 8px 8px 0;
}

.store__sidebar-brand-btn:focus-visible {
  outline: 2px solid #e65c00;
  outline-offset: -2px;
}

.store__sidebar-brand-name {
  flex: 1;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

.store__sidebar-brand-arrow {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  margin-inline-start: 0.5rem;
  color: inherit;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.store__sidebar-brand-arrow svg {
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  width: 16px;
  height: 16px;
}

.store__sidebar-item--active .store__sidebar-brand-arrow {
  transform: rotate(180deg);
  color: #e65c00;
}

/* ─── 6. Subcategories Container (Desktop Accordion Panel) ────────────────── */

.store__sidebar-children {
  list-style: none;
  margin: 2px 0 6px 0;
  padding: 4px 0;
  background: transparent;
  border: none !important;
  border-radius: 8px;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.store__sidebar-child {
  margin-bottom: 2px;
  border: none !important;
}

.store__sidebar-child-btn {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 10px 35px 10px 16px;
  background: transparent;
  border: none !important;
  border-radius: 8px;
  color: #64748b;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 400;
  cursor: pointer;
  text-align: right;
  direction: rtl;
  transition: all 0.3s ease;
  position: relative;
  box-sizing: border-box;
}

.store__sidebar-child-btn:hover {
  color: #e65c00;
  background-color: #fff8f5;
  transform: translateX(-4px);
}

.store__sidebar-child-btn--active,
.store__sidebar-child-btn.active {
  color: #e65c00 !important;
  font-weight: 600 !important;
  background-color: #fff8f5;
  transform: translateX(-4px);
}

.store__sidebar-child-btn--active::before,
.store__sidebar-child-btn.active::before {
  content: '';
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 5px;
  background-color: #e65c00;
  border-radius: 50%;
}

.store__sidebar-child--loading {
  padding: 10px 35px;
  color: #94a3b8;
  font-size: 0.82rem;
  font-style: italic;
  text-align: right;
  direction: rtl;
}

/* ─── 7. Product Grid Layout Fixes ────────────────────────────────────────── */

.store__grid {
  grid-column: auto !important;
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 24px;
  min-width: 0;
  width: 100%;
}

/* ─── 8. Mobile & Tablet App-Like Experience (@media (max-width: 992px)) ───── */

@media (max-width: 992px) {

  /* Compact Store Container on Mobile */
  .store {
    padding: 12px 10px !important;
  }

  /* Main store body stacks sidebar above products */
  .store__body {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  /* Compact Sticky Horizontal Header Filter Bar */
  .store__sidebar {
    position: sticky !important;
    top: 0 !important;
    z-index: 100 !important;
    background: #ffffff !important;
    border: none !important;
    border-bottom: 1px solid #e2e8f0 !important;
    border-radius: 0 0 10px 10px !important;
    box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.06) !important;
    padding: 6px 10px !important;
    max-height: none !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch !important;
    margin-bottom: 8px !important;
  }

  /* Hide custom scrollbars for horizontal touch containers */
  .store__sidebar::-webkit-scrollbar,
  .store__sidebar-list::-webkit-scrollbar,
  .store__sidebar-children::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }

  /* Compact Pill Back Button on Mobile */
  .store__sidebar-back-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    max-width: max-content !important;
    padding: 6px 12px !important;
    margin-bottom: 6px !important;
    border-radius: 50px !important;
    background: #fff8f5 !important;
    border: 1px solid #e65c00 !important;
    color: #e65c00 !important;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    box-shadow: none !important;
  }

  .store__sidebar-back-btn:hover {
    background: #e65c00 !important;
    color: #ffffff !important;
    border-color: #e65c00 !important;
  }

  /* Horizontal Scrolling Category (Brand) List */
  .store__sidebar-list {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    padding: 2px 0 !important;
    margin: 0 !important;
    width: 100% !important;
  }

  .store__sidebar-item {
    flex-shrink: 0 !important;
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
  }

  /* Brand Buttons styled as Chips / Pills */
  .store__sidebar-brand-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    padding: 7px 15px !important;
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 50px !important;
    color: #1a2b4c !important;
    font-size: 0.85rem !important;
    font-weight: 500 !important;
    white-space: nowrap !important;
    transition: all 0.25s ease !important;
    box-sizing: border-box !important;
  }

  /* Active Brand Chip: High Contrast Dark Navy (#1a2b4c) with Pure White text & icon */
  .store__sidebar-item--active .store__sidebar-brand-btn,
  .store__sidebar-brand-btn.active,
  .store__sidebar-brand-btn--active {
    background: #1a2b4c !important;
    color: #ffffff !important;
    border-color: #1a2b4c !important;
    border-radius: 50px !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 8px rgba(26, 43, 76, 0.2) !important;
  }

  .store__sidebar-item--active .store__sidebar-brand-name,
  .store__sidebar-brand-btn.active .store__sidebar-brand-name,
  .store__sidebar-brand-btn--active .store__sidebar-brand-name {
    color: #ffffff !important;
  }

  .store__sidebar-item--active .store__sidebar-brand-arrow,
  .store__sidebar-brand-btn.active .store__sidebar-brand-arrow,
  .store__sidebar-brand-btn--active .store__sidebar-brand-arrow {
    color: #ffffff !important;
  }

  .store__sidebar-item--active .store__sidebar-brand-arrow svg,
  .store__sidebar-brand-btn.active .store__sidebar-brand-arrow svg,
  .store__sidebar-brand-btn--active .store__sidebar-brand-arrow svg {
    stroke: #ffffff !important;
    color: #ffffff !important;
  }

  .store__sidebar-brand-name {
    font-size: 0.85rem !important;
    font-weight: inherit !important;
  }

  .store__sidebar-brand-arrow {
    display: inline-flex !important;
    margin-inline-start: 4px !important;
  }

  .store__sidebar-brand-arrow svg {
    width: 12px !important;
    height: 12px !important;
  }

  /* Secondary Horizontal Row for Subcategories when Brand is Expanded */
  .store__sidebar-children {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    padding: 4px 0 2px 0 !important;
    margin: 4px 0 0 0 !important;
    border: none !important;
    width: 100% !important;
    transition: max-height 0.3s ease, opacity 0.3s ease !important;
  }

  .store__sidebar-item--active .store__sidebar-children {
    max-height: 50px !important;
    opacity: 1 !important;
  }

  .store__sidebar-child {
    flex-shrink: 0 !important;
    margin: 0 !important;
  }

  /* Subcategory Buttons as Smaller Chips */
  .store__sidebar-child-btn {
    display: inline-flex !important;
    align-items: center !important;
    padding: 5px 12px !important;
    background: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 50px !important;
    color: #64748b !important;
    font-size: 0.8rem !important;
    font-weight: 400 !important;
    white-space: nowrap !important;
    transform: none !important;
    transition: all 0.25s ease !important;
  }

  /* Hover & Active State for Subcategory Chips: Orange Highlight (#e65c00) */
  .store__sidebar-child-btn:hover,
  .store__sidebar-child-btn--active,
  .store__sidebar-child-btn.active {
    color: #e65c00 !important;
    background: #fff8f5 !important;
    border-color: #e65c00 !important;
    font-weight: 600 !important;
    transform: none !important;
  }

  .store__sidebar-child-btn--active::before,
  .store__sidebar-child-btn.active::before {
    display: none !important; /* Hide bullet point on mobile horizontal chips */
  }

  .store__grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }
}

@media (max-width: 480px) {
  .store__grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
}

@media (max-width: 768px) {
  .store__header {
    gap: 12px;
  }

  .store__search {
    order: 3;
    width: 100%;
    max-width: 100%;
    margin: 4px 0 0 0;
  }
}
