/* ==============================================
   PetFi Discovery Styles
   Carousel/shelf layouts and quiz components
   ============================================== */

/* ==============================================
   CAROUSEL/SHELF
   ============================================== */

.shelf {
  position: relative;
  margin-bottom: 32px;
}

.shelf__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 0 16px;
}

.shelf__title {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--gray-900);
}

.shelf__arrow {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: white;
  border: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.shelf__arrow:hover {
  background: var(--gray-50);
  box-shadow: var(--shadow-md);
}

.shelf__track {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 8px 16px 16px;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.shelf__track::-webkit-scrollbar {
  display: none;
}

/* ==============================================
   QUIZ COMPONENTS
   ============================================== */

.quiz-container {
  min-height: 100vh;
  background: var(--gradient-purple);
}

.quiz-card {
  background: white;
  border-radius: var(--radius-2xl);
  padding: 32px;
  box-shadow: var(--shadow-xl);
  max-width: 480px;
  margin: 0 auto;
}

.quiz-option {
  display: block;
  width: 100%;
  padding: 16px 20px;
  background: var(--gray-50);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-xl);
  font-size: var(--font-size-base);
  font-weight: 500;
  color: var(--gray-700);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
}

.quiz-option:hover {
  border-color: var(--petfi-purple-400);
  background: var(--petfi-purple-50);
}

.quiz-option--selected {
  border-color: var(--petfi-purple-600);
  background: var(--petfi-purple-50);
  color: var(--petfi-purple-700);
}

.quiz-progress {
  height: 4px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.quiz-progress__bar {
  height: 100%;
  background: var(--gradient-purple);
  transition: width var(--transition-slow);
}

/* ==============================================
   Mobile filters bottom-sheet + sticky button
   Visible only at < --bp-md (768px). Toggle via
   data-open attr (mobile_filters_sheet.js).
   ============================================== */

.sticky-filter-wrap,
.sticky-filter-anchor {
  position: sticky;
  top: 64px;
  z-index: var(--z-sticky-filter);
  display: flex;
  justify-content: flex-end;
  padding: 8px 16px;
  pointer-events: none;
}

.sticky-filter-btn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: #ffffff;
  color: var(--gray-800);
  border: 1px solid var(--gray-200);
  border-radius: 9999px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  min-height: 44px;
}

.sticky-filter-btn__icon {
  font-size: 16px;
  line-height: 1;
}

.sticky-filter-btn__label {
  line-height: 1;
}

.sticky-filter-btn__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--petfi-purple-600);
  color: #ffffff;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

@media (min-width: 768px) {
  .sticky-filter-wrap,
  .sticky-filter-anchor {
    display: none !important;
  }
}

.filters-sheet {
  position: fixed;
  inset: 0;
  z-index: var(--z-dialog);
  display: none;
  pointer-events: none;
  font-family: var(--font-sans);
}

.filters-sheet[data-open="true"] {
  display: block;
  pointer-events: auto;
}

.filters-sheet__scrim {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(17, 24, 39, 0.55);
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  z-index: var(--z-scrim);
  opacity: 0;
  transition: opacity 200ms ease-out;
}

.filters-sheet[data-open="true"] .filters-sheet__scrim {
  opacity: 1;
}

.filters-sheet__panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 90vh;
  background: #ffffff;
  z-index: var(--z-dialog);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.16);
  transform: translateY(100%);
  transition: transform 250ms ease-out;
  display: flex;
  flex-direction: column;
}

.filters-sheet[data-open="true"] .filters-sheet__panel {
  transform: translateY(0);
}

.filters-sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
}

.filters-sheet__title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
}

.filters-sheet__close {
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  background: var(--gray-100);
  color: var(--gray-700);
  border: none;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.filters-sheet__body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  -webkit-overflow-scrolling: touch;
}

.filters-sheet__footer {
  display: flex;
  gap: 12px;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--gray-100);
  background: #ffffff;
}

.filters-sheet__clear {
  flex: 0 0 auto;
  padding: 12px 18px;
  background: transparent;
  color: var(--gray-700);
  border: 1px solid var(--gray-200);
  border-radius: 9999px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
}

.filters-sheet__apply {
  flex: 1;
  padding: 12px 18px;
  background: linear-gradient(135deg, #9638EB 0%, #7C3AED 100%);
  color: #ffffff;
  border: none;
  border-radius: 9999px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
  box-shadow: 0 4px 14px rgba(150, 56, 235, 0.25);
}

@media (min-width: 768px) {
  .filters-sheet {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .filters-sheet__panel,
  .filters-sheet__scrim {
    transition: none;
  }
}

/* /adoptar filter bar — mobile responsive overrides */
@media (max-width: 767px) {
  .adoptar-species-row {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }
  /* 2×2 grid for the 4 species chips — avoids horizontal overflow on
     narrow viewports (375px iPhone) where the row layout clips "Otros". */
  .adoptar-species-chips {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    width: 100%;
  }
  .adoptar-species-chips > a {
    justify-content: center !important;
    padding: 10px 12px !important;
    min-width: 0;
  }
  .adoptar-region-divider {
    display: none !important;
  }
  .adoptar-region-select {
    width: 100%;
  }
  .adoptar-region-select > select {
    width: 100% !important;
  }
}
