/* ========================================
   STUDENTFINDS - FILTERS PILLS
   Premium UI - Mobile-first, Responsive, Dark/Light Theme
   ======================================== */

/* Section principale */
.sf-filters-section {
  padding: 24px 20px 20px;
  background: #ffffff;
  transition: background 0.3s ease;
}

/* Dark mode */
body.dark-mode .sf-filters-section,
html.dark-mode .sf-filters-section {
  background: #1f2c3f;
}

.sf-filters-wrapper {
  max-width: 100%;
  margin: 0 auto;
  padding: 0;
}

/* Category Title "Choisis une catégorie" */
.sf-category-title {
  font-size: 20px;
  font-weight: 600;
  text-align: center;
  margin: 0 0 16px 0;
  color: var(--sf-text-primary, #1a1a1a);
  transition: color 0.3s ease;
}

/* Container de la barre de filtres */
.sf-filters-bar {
  display: flex;
  gap: 8px;
  align-items: stretch;
  flex-wrap: nowrap;
  max-width: 100%;
  margin: 0 auto;
}

/* Zone gauche - Catégorie parente (1/3) */
.sf-filters-parent {
  position: relative;
  flex: 0 0 auto;
  min-width: 150px;
  max-width: 200px;
}

/* Zone droite - Sous-catégories (2/3) */
.sf-filters-children {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(5, 147, 212, 0.25) transparent;
}

.sf-filters-children::-webkit-scrollbar {
  height: 5px;
}

.sf-filters-children::-webkit-scrollbar-track {
  background: transparent;
}

.sf-filters-children::-webkit-scrollbar-thumb {
  background: rgba(5, 147, 212, 0.25);
  border-radius: 3px;
}

.sf-filters-children::-webkit-scrollbar-thumb:hover {
  background: rgba(5, 147, 212, 0.4);
}

/* Container des pills enfants */
.sf-filters-children-list {
  display: flex;
  gap: 7px;
  padding-bottom: 8px;
}

/* PILL DESIGN */
.sf-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  background: var(--sf-pill-bg, #f2f2f2);
  border: 1px solid var(--sf-pill-border, rgba(0, 0, 0, 0.08));
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  color: var(--sf-text-primary, #1a1a1a);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  min-height: 48px;
  box-shadow: var(--sf-pill-shadow, 0 1px 3px rgba(0, 0, 0, 0.04));
}

/* Emoji dans le pill */
.sf-pill-emoji {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
}

/* Texte du pill */
.sf-pill-text {
  flex: 1;
}

/* Wrapper pour texte + sous-texte (pills désactivées) */
.sf-pill-text-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

/* Sous-texte "arrive bientôt" */
.sf-pill-subtitle {
  font-size: 11px;
  font-weight: 400;
  opacity: 0.65;
}

/* Chevron */
.sf-pill-chevron {
  font-size: 12px;
  transition: transform 0.2s ease;
  flex-shrink: 0;
  opacity: 0.85;
}

/* États du pill - HOVER PREMIUM */
.sf-pill:hover:not(.sf-pill-disabled) {
  background: var(--sf-pill-hover-bg, #ececec);
  border-color: var(--sf-pill-hover-border, rgba(5, 147, 212, 0.3));
  box-shadow: var(--sf-pill-hover-shadow, 0 2px 6px rgba(0, 0, 0, 0.06));
}

.sf-pill:active:not(.sf-pill-disabled) {
  transform: scale(0.98);
}

/* Pill principal actif - POIDS VISUEL MAXIMAL */
.sf-pill-main {
  width: 100%;
  background: var(--sf-pill-active-bg, #0593d4);
  color: var(--sf-pill-active-text, #ffffff);
  border-color: var(--sf-pill-active-border, #0593d4);
  font-weight: 700;
  box-shadow: var(--sf-pill-main-shadow, 0 2px 8px rgba(5, 147, 212, 0.25));
}

.sf-pill-main:hover {
  background: var(--sf-pill-active-hover-bg, #047bb8);
  border-color: var(--sf-pill-active-hover-border, #047bb8);
  box-shadow: var(--sf-pill-main-hover-shadow, 0 3px 10px rgba(5, 147, 212, 0.3));
}

.sf-pill-main .sf-pill-chevron.open {
  transform: rotate(180deg);
}

/* Pill désactivé - HOVER VISUEL SUBTIL */
.sf-pill-disabled {
  cursor: not-allowed;
  background: var(--sf-pill-disabled-bg, #f5f5f5);
  color: var(--sf-pill-disabled-text, #aaaaaa);
  border-color: var(--sf-pill-disabled-border, rgba(0, 0, 0, 0.06));
  opacity: 0.75;
  align-items: flex-start;
  padding: 14px 18px;
  min-height: 56px;
  font-weight: 500;
}

.sf-pill-disabled:hover {
  background: var(--sf-pill-disabled-hover-bg, #efefef);
  border-color: var(--sf-pill-disabled-hover-border, rgba(0, 0, 0, 0.08));
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  opacity: 0.82;
}

/* Pill enfant (sous-catégorie) - CALME, SECONDAIRE */
.sf-pill-child {
  background: #f2f2f2 !important;
  background-color: #f2f2f2 !important;
  border: 1px solid rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
  font-weight: 500;
  color: #1a1a1a !important;
}

.sf-pill-child:hover {
  background: #e8e8e8 !important;
  background-color: #e8e8e8 !important;
  border-color: rgba(5, 147, 212, 0.4);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  color: #1a1a1a !important;
}

/* Active state for selected subcategory */
.sf-pill-child.sf-pill-active {
  background: #0593d4 !important;
  background-color: #0593d4 !important;
  border-color: #0593d4;
  color: #ffffff !important;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(5, 147, 212, 0.3);
}

.sf-pill-child.sf-pill-active:hover {
  background: #047ab8 !important;
  background-color: #047ab8 !important;
  border-color: #047ab8;
  color: #ffffff !important;
}

.sf-pill-child.sf-pill-active .sf-pill-text {
  color: #ffffff !important;
}

/* Dropdown - FOND VOILÉ, EXTENSION NATURELLE */
.sf-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--sf-dropdown-bg, rgba(255, 255, 255, 0.95));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 12px;
  padding: 6px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.15s ease;
  box-shadow: var(--sf-dropdown-shadow, 0 4px 16px rgba(0, 0, 0, 0.08));
}

.sf-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.sf-dropdown-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sf-dropdown .sf-pill {
  width: 100%;
  justify-content: flex-start;
  font-weight: 500;
  box-shadow: none;
}

.sf-dropdown .sf-pill:hover {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

/* Overlay pour fermer le dropdown */
.sf-dropdown-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: transparent;
  z-index: 999;
  display: none;
}

.sf-dropdown-overlay.active {
  display: block;
}

/* ========================================
   RESPONSIVE
   ======================================== */

/* Mobile (< 768px) */
@media (max-width: 767px) {
  .sf-filters-section {
    padding: 30px 16px;
  }
  
  .sf-filters-title {
    font-size: 28px;
    margin-bottom: 24px;
  }
  
  .sf-filters-bar {
    gap: 7px;
  }
  
  .sf-filters-parent {
    min-width: 120px;
    max-width: 140px;
  }
  
  .sf-pill {
    padding: 10px 14px;
    font-size: 14px;
    min-height: 44px;
    border-radius: 10px;
  }
  
  .sf-pill-disabled {
    padding: 12px 14px;
    min-height: 52px;
  }
  
  .sf-pill-emoji {
    width: 20px;
    height: 20px;
  }
  
  .sf-pill-subtitle {
    font-size: 10px;
  }
  
  .sf-dropdown {
    border-radius: 10px;
    padding: 5px;
  }
  
  /* Afficher ~2.5 pills en mobile */
  .sf-filters-children-list {
    gap: 6px;
  }
  
  .sf-filters-children-list .sf-pill-child {
    min-width: 130px;
  }
}

/* Tablet (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
  .sf-filters-wrapper {
    width: 100%;
    max-width: 100%;
    padding: 0 20px;
  }
  
  .sf-filters-parent {
    min-width: 160px;
    max-width: 180px;
  }
  
  .sf-filters-children-list .sf-pill-child {
    min-width: 140px;
  }
}

/* Desktop (> 1024px) - ALIGNEMENT & FINESSE */
@media (min-width: 1025px) {
  .sf-filters-section {
    padding: 50px 0;
  }
  
  .sf-filters-wrapper {
    width: 980px;
    max-width: 980px;
    padding: 0;
    margin: 0 auto;
  }
  
  .sf-filters-title {
    font-size: 36px;
    margin-bottom: 40px;
    text-align: left;
  }
  
  .sf-filters-bar {
    gap: 10px;
    max-width: 100%;
  }
  
  .sf-pill {
    padding: 14px 20px;
    font-size: 16px;
    border-radius: 13px;
  }
  
  .sf-pill-disabled {
    padding: 16px 20px;
    min-height: 60px;
  }
  
  .sf-pill-emoji {
    width: 26px;
    height: 26px;
  }
  
  .sf-pill-subtitle {
    font-size: 12px;
  }
  
  .sf-dropdown {
    border-radius: 13px;
    padding: 7px;
  }
  
  /* Plus de pills visibles en desktop */
  .sf-filters-children-list {
    gap: 8px;
  }
  
  .sf-filters-children-list .sf-pill-child {
    min-width: auto;
  }
}

/* ========================================
   LIGHT MODE EXPLICIT - FORCE GRAY
   ======================================== */

/* Force light gray for subcategories in light mode */
.sf-filters-section .sf-pill-child,
.sf-filters-bar .sf-pill-child,
button.sf-pill-child {
  background: #f2f2f2 !important;
  background-color: #f2f2f2 !important;
  color: #1a1a1a !important;
}

.sf-filters-section .sf-pill-child:hover,
.sf-filters-bar .sf-pill-child:hover,
button.sf-pill-child:hover {
  background: #e8e8e8 !important;
  background-color: #e8e8e8 !important;
  color: #1a1a1a !important;
}

/* ========================================
   DARK THEME SUPPORT - CONTRASTE MODÉRÉ
   ======================================== */

@media (prefers-color-scheme: dark) {
  :root {
    --sf-bg-primary: #1a1a1a;
    --sf-text-primary: #ffffff;
    --sf-pill-bg: #2a2a2a;
    --sf-pill-border: rgba(255, 255, 255, 0.08);
    --sf-pill-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    --sf-pill-hover-bg: #323232;
    --sf-pill-hover-border: rgba(5, 147, 212, 0.4);
    --sf-pill-hover-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    --sf-pill-active-bg: #0593d4;
    --sf-pill-active-text: #ffffff;
    --sf-pill-active-border: #0593d4;
    --sf-pill-main-shadow: 0 2px 8px rgba(5, 147, 212, 0.4);
    --sf-pill-main-hover-shadow: 0 3px 10px rgba(5, 147, 212, 0.5);
    --sf-pill-active-hover-bg: #047bb8;
    --sf-pill-active-hover-border: #047bb8;
    --sf-pill-disabled-bg: #252525;
    --sf-pill-disabled-text: #666666;
    --sf-pill-disabled-border: rgba(255, 255, 255, 0.05);
    --sf-pill-disabled-hover-bg: #2c2c2c;
    --sf-pill-disabled-hover-border: rgba(255, 255, 255, 0.08);
    --sf-dropdown-bg: rgba(30, 30, 30, 0.95);
    --sf-dropdown-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  }
  
  .sf-pill-child {
    background: #3a3a3a !important;
    background-color: #3a3a3a !important;
    border-color: rgba(255, 255, 255, 0.08);
    color: #d0d0d0 !important;
  }
  
  .sf-pill-child:hover {
    background: #424242 !important;
    background-color: #424242 !important;
    border-color: rgba(5, 147, 212, 0.5);
  }
}

/* Support explicite pour .dark-mode class */
.dark-mode .sf-filters-section,
body.dark-mode .sf-filters-section {
  --sf-bg-primary: #1a1a1a;
  --sf-text-primary: #ffffff;
  --sf-pill-bg: #2a2a2a;
  --sf-pill-border: rgba(255, 255, 255, 0.08);
  --sf-pill-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  --sf-pill-hover-bg: #323232;
  --sf-pill-hover-border: rgba(5, 147, 212, 0.4);
  --sf-pill-hover-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  --sf-pill-active-bg: #0593d4;
  --sf-pill-active-text: #ffffff;
  --sf-pill-active-border: #0593d4;
  --sf-pill-main-shadow: 0 2px 8px rgba(5, 147, 212, 0.4);
  --sf-pill-main-hover-shadow: 0 3px 10px rgba(5, 147, 212, 0.5);
  --sf-pill-active-hover-bg: #047bb8;
  --sf-pill-active-hover-border: #047bb8;
  --sf-pill-disabled-bg: #252525;
  --sf-pill-disabled-text: #666666;
  --sf-pill-disabled-border: rgba(255, 255, 255, 0.05);
  --sf-pill-disabled-hover-bg: #2c2c2c;
  --sf-pill-disabled-hover-border: rgba(255, 255, 255, 0.08);
  --sf-dropdown-bg: rgba(30, 30, 30, 0.95);
  --sf-dropdown-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.dark-mode .sf-pill-child,
body.dark-mode .sf-pill-child {
  background: #3a3a3a !important;
  background-color: #3a3a3a !important;
  border-color: rgba(255, 255, 255, 0.08);
  color: #d0d0d0 !important;
}

.dark-mode .sf-pill-child:hover,
body.dark-mode .sf-pill-child:hover {
  background: #424242 !important;
  background-color: #424242 !important;
  border-color: rgba(5, 147, 212, 0.5);
}

/* Active state in dark mode */
.dark-mode .sf-pill-child.sf-pill-active,
body.dark-mode .sf-pill-child.sf-pill-active,
html.dark-mode .sf-pill-child.sf-pill-active {
  background: #0593d4 !important;
  background-color: #0593d4 !important;
  border-color: #0593d4;
  color: #ffffff !important;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(5, 147, 212, 0.4);
}

.dark-mode .sf-pill-child.sf-pill-active:hover,
body.dark-mode .sf-pill-child.sf-pill-active:hover,
html.dark-mode .sf-pill-child.sf-pill-active:hover {
  background: #047ab8 !important;
  background-color: #047ab8 !important;
  border-color: #047ab8;
  color: #ffffff !important;
}

.dark-mode .sf-pill-child.sf-pill-active .sf-pill-text,
body.dark-mode .sf-pill-child.sf-pill-active .sf-pill-text,
html.dark-mode .sf-pill-child.sf-pill-active .sf-pill-text {
  color: #ffffff !important;
}

/* ========================================
   FINAL OVERRIDE - FORCE LIGHT GRAY
   ======================================== */

/* Ultimate override for light mode - very light gray */
html:not(.dark-mode) .sf-pill-child,
html:not(.dark-mode) button.sf-pill-child,
body:not(.dark-mode) .sf-pill-child,
body:not(.dark-mode) button.sf-pill-child,
.sf-filters-children .sf-pill-child,
button[data-subcategory].sf-pill-child,
.sf-filters-children-list .sf-pill-child {
  background: #f2f2f2 !important;
  background-color: #f2f2f2 !important;
  color: #1a1a1a !important;
}

html:not(.dark-mode) .sf-pill-child:hover,
html:not(.dark-mode) button.sf-pill-child:hover,
body:not(.dark-mode) .sf-pill-child:hover,
body:not(.dark-mode) button.sf-pill-child:hover,
.sf-filters-children .sf-pill-child:hover,
button[data-subcategory].sf-pill-child:hover,
.sf-filters-children-list .sf-pill-child:hover {
  background: #e8e8e8 !important;
  background-color: #e8e8e8 !important;
  color: #1a1a1a !important;
}

/* ULTRA SPECIFIC - Target each subcategory directly */
button[data-subcategory="burger"],
button[data-subcategory="pizza"],
button[data-subcategory="sushi"],
button[data-subcategory="tacos"] {
  background: #f2f2f2 !important;
  background-color: #f2f2f2 !important;
  color: #1a1a1a !important;
}

button[data-subcategory="burger"]:hover,
button[data-subcategory="pizza"]:hover,
button[data-subcategory="sushi"]:hover,
button[data-subcategory="tacos"]:hover {
  background: #e8e8e8 !important;
  background-color: #e8e8e8 !important;
  color: #1a1a1a !important;
}

/* Force text color on subcategory pills */
.sf-pill-child,
.sf-pill-child .sf-pill-text,
button.sf-pill-child,
button.sf-pill-child .sf-pill-text,
button[data-subcategory] .sf-pill-text {
  color: #1a1a1a !important;
}

.sf-pill-child:hover,
.sf-pill-child:hover .sf-pill-text,
button.sf-pill-child:hover,
button.sf-pill-child:hover .sf-pill-text,
button[data-subcategory]:hover .sf-pill-text {
  color: #1a1a1a !important;
}

/* ========================================
   DESKTOP RESPONSIVE (768px+)
   ======================================== */
@media screen and (min-width: 768px) {
  /* Center category bar on desktop, but don't exceed cards grid width */
  .sf-filters-wrapper {
    max-width: 1140px; /* Same as cards grid container */
    margin: 0 auto;
  }
  
  .sf-filters-bar {
    justify-content: center;
    max-width: 100%;
  }
  
  /* Desktop: Enable horizontal scroll if too many pills */
  .sf-filters-children {
    overflow-x: auto;
    max-width: 100%;
  }
  
  .sf-category-title {
    font-size: 22px;
    margin-bottom: 20px;
  }
  
  .sf-filters-section {
    padding: 28px 20px 20px;
  }
}

/* ========================================
   MOBILE HERO (Phone only, max 767px)
   ======================================== */
@media screen and (max-width: 767px) {
  /* Mobile hero container */
  .sf-mobile-hero {
    width: 100%;
    height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    transition: background 0.3s ease;
  }
  
  /* Dark mode mobile hero */
  body.dark-mode .sf-mobile-hero,
  html.dark-mode .sf-mobile-hero {
    background: #0b1727;
  }
  
  .sf-mobile-hero img {
    max-width: 70vw;
    max-height: 35vh;
    width: auto;
    height: auto;
    object-fit: contain;
  }
  
  /* Category area */
  .sf-filters-section {
    background: #ffffff !important;
  }
  
  body.dark-mode .sf-filters-section,
  html.dark-mode .sf-filters-section {
    background: #1f2c3f !important;
  }
}

/* ========================================
   DESKTOP HERO COLORS (Light mode contrast)
   ======================================== */
@media screen and (min-width: 768px) {
  /* Hero background */
  .sf-hero-section {
    background-color: #f5f5f5 !important;
  }
  
  /* Category area */
  .sf-filters-section {
    background: #ffffff !important;
  }
  
  /* Dark mode */
  body.dark-mode .sf-hero-section,
  html.dark-mode .sf-hero-section {
    background-color: #0b1727 !important;
  }
  
  body.dark-mode .sf-filters-section,
  html.dark-mode .sf-filters-section {
    background: #1f2c3f !important;
  }
}

