/* ============================================================
   SIMPLEX ANALYSIS FILTER — Pill/Dropdown стиль
   simplex-lab.ru (Lato, #0e6bad brand, #dd2a1b accent)
   ============================================================ */

:root {
  --af-brand: #0e6bad;
  --af-brand-hover: #0b5a91;
  --af-brand-dark: #094a78;
  --af-brand-light: #e8f1f8;
  --af-brand-50: #f4f8fb;
  --af-accent: #dd2a1b;
  --af-accent-hover: #c02115;
  --af-ink: #141414;
  --af-ink-2: #4a4a4a;
  --af-ink-3: #a6a6a6;
  --af-line: #d9d9d9;
  --af-line-2: #eee;
  --af-bg: #f5f5f5;
  --af-card: #fff;
  --af-shadow-sm: 0 .25rem 1.25rem 0 rgba(0,0,0,.05);
  --af-shadow-md: 0 .25rem 1.875rem rgba(0,0,0,.1);
  --af-shadow-lg: 0 .25rem 3.225rem 0 rgba(0,0,0,.15);
  --af-shadow-card: 0 .375rem 1.5rem 0 rgba(0,0,0,.05), 0 0 0 .0625rem rgba(0,0,0,.08);
  --af-radius: 17px;
  --af-pill: 33px;
}

/* === Container === */
.af-filter {
  background: var(--af-card);
  border: 1px solid var(--af-line-2);
  border-radius: var(--af-radius);
  margin-bottom: 24px;
  box-shadow: var(--af-shadow-card);
  transition: all .2s ease;
  overflow: visible;
  position: relative;
  font-family: 'Lato', system-ui, -apple-system, sans-serif;
}
.af-filter.is-active {
  border-color: rgba(14,107,173,0.3);
  box-shadow: 0 .375rem 1.5rem 0 rgba(14,107,173,0.1),
              0 0 0 .0625rem rgba(14,107,173,0.15);
}

/* === Main bar === */
.af-filter__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 14px 16px;
}

.af-spacer { flex: 1 1 auto; min-width: 8px; }

/* === Search === */
.af-search-field {
  position: relative;
  flex: 1 1 280px;
  min-width: 220px;
}
.af-search-field__input {
  width: 100%;
  padding: 10px 38px 10px 40px;
  font-size: 14px;
  font-family: 'Lato', sans-serif;
  color: var(--af-ink);
  background: var(--af-bg);
  border: 1px solid transparent;
  border-radius: var(--af-pill);
  outline: none;
  transition: all .2s;
  box-sizing: border-box;
}
.af-search-field__input::placeholder { color: var(--af-ink-3); }
.af-search-field__input:focus {
  background: #fff;
  border-color: var(--af-brand);
  box-shadow: 0 0 0 3px rgba(14,107,173,0.12);
}
.af-search-field__ico {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--af-ink-3);
  font-size: 13px;
  pointer-events: none;
  transition: color .2s;
}
.af-search-field__input:focus ~ .af-search-field__ico { color: var(--af-brand); }
.af-search-field__clear {
  position: absolute;
  right: 6px; top: 50%;
  transform: translateY(-50%);
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--af-ink-3);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all .2s;
  padding: 0;
}
.af-search-field__clear:hover { background: var(--af-line-2); color: var(--af-accent); }
.af-search-field.has-value .af-search-field__clear { display: flex; }

/* === Chip groups (gender / age) === */
.af-chip-group {
  display: inline-flex;
  background: var(--af-bg);
  border-radius: var(--af-pill);
  padding: 4px;
  gap: 2px;
  border: 1px solid var(--af-line-2);
}
.af-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--af-ink-2);
  border-radius: 28px;
  cursor: pointer;
  transition: all .2s;
  border: 0;
  background: transparent;
  white-space: nowrap;
  font-family: 'Lato', sans-serif;
  line-height: 1;
}
.af-chip:hover { color: var(--af-ink); }
.af-chip.active {
  background: var(--af-brand);
  color: #fff;
  box-shadow: 0 2px 6px rgba(14,107,173,0.25);
}
.af-chip i { font-size: 11px; }

/* === Dropdown triggers (pill-shaped) === */
.af-trigger-wrap { position: relative; }
.af-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--af-ink-2);
  background: var(--af-bg);
  border: 1px solid var(--af-line-2);
  border-radius: var(--af-pill);
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
  max-width: 300px;
  font-family: 'Lato', sans-serif;
  line-height: 1;
}
.af-trigger:hover {
  border-color: var(--af-brand);
  color: var(--af-brand);
}
.af-trigger[aria-expanded="true"] {
  background: var(--af-brand-light);
  color: var(--af-brand-dark);
  border-color: var(--af-brand);
}
.af-trigger.has-selection {
  background: var(--af-brand);
  color: #fff;
  border-color: var(--af-brand);
}
.af-trigger.has-selection .af-trigger__caret { border-top-color: #fff; }
.af-trigger.has-selection .af-trigger__ico { color: rgba(255,255,255,0.85); }
.af-trigger__ico {
  color: var(--af-ink-3);
  font-size: 12px;
  transition: color .2s;
}
.af-trigger:hover .af-trigger__ico { color: var(--af-brand); }
.af-trigger__label {
  overflow: hidden;
  text-overflow: ellipsis;
}
.af-trigger__caret {
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid currentColor;
  transition: transform .2s ease;
  opacity: 0.6;
  margin-left: 2px;
  flex-shrink: 0;
}
.af-trigger[aria-expanded="true"] .af-trigger__caret {
  transform: rotate(180deg);
  opacity: 1;
}
.af-trigger__pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: #fff;
  color: var(--af-brand);
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
}

/* === Toggle (На дому) === */
.af-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 14px;
  background: var(--af-bg);
  border: 1px solid var(--af-line-2);
  border-radius: var(--af-pill);
  cursor: pointer;
  transition: all .2s;
  user-select: none;
  margin: 0;
}
.af-toggle:hover { border-color: var(--af-brand); }
.af-toggle.on {
  background: var(--af-brand-light);
  border-color: var(--af-brand);
}
.af-toggle__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--af-ink-2);
  white-space: nowrap;
}
.af-toggle.on .af-toggle__label { color: var(--af-brand-dark); }
.af-toggle__ico {
  color: var(--af-ink-3);
  font-size: 13px;
  transition: color .2s;
}
.af-toggle.on .af-toggle__ico { color: var(--af-brand); }
.af-toggle:hover .af-toggle__ico { color: var(--af-brand); }

.af-switch { position: relative; width: 34px; height: 18px; flex-shrink: 0; display: inline-block; }
.af-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.af-switch__slider {
  position: absolute; inset: 0;
  background: var(--af-line);
  border-radius: 18px;
  transition: .2s;
  cursor: pointer;
}
.af-switch__slider::before {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  left: 2px; bottom: 2px;
  background: #fff;
  border-radius: 50%;
  transition: .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.af-switch input:checked + .af-switch__slider { background: var(--af-brand); }
.af-switch input:checked + .af-switch__slider::before { transform: translateX(16px); }

/* === Tags row === */
.af-tags {
  padding: 0 16px 14px;
}
.af-tags__row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--af-line-2);
}
.af-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px 5px 12px;
  background: var(--af-brand-light);
  color: var(--af-brand-dark);
  border: 1px solid rgba(14,107,173,0.2);
  border-radius: 28px;
  font-size: 12px;
  font-weight: 600;
  max-width: 320px;
  animation: afTagIn .2s ease;
  font-family: 'Lato', sans-serif;
}
@keyframes afTagIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
.af-tag__cat {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--af-brand);
  font-weight: 700;
}
.af-tag__val {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}
.af-tag__x {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--af-brand);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  transition: all .2s;
  padding: 0;
  flex-shrink: 0;
}
.af-tag__x:hover { background: rgba(14,107,173,0.15); color: var(--af-brand-hover); }

.af-clear-all {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--af-accent);
  background: transparent;
  border: 1px dashed rgba(221,42,27,0.35);
  border-radius: 28px;
  cursor: pointer;
  transition: all .2s;
  font-family: 'Lato', sans-serif;
}
.af-clear-all:hover {
  color: #fff;
  background: var(--af-accent);
  border-color: var(--af-accent);
}

/* === Dropdown panel === */
.af-dd-host {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
}
.af-dd {
  position: absolute;
  background: #fff;
  border: 1px solid var(--af-line-2);
  border-radius: var(--af-radius);
  box-shadow: var(--af-shadow-lg);
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  overflow: hidden;
  max-width: 440px;
}
.af-dd.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.af-dd__head {
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--af-line-2);
  background: var(--af-bg);
}
.af-dd__title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
}
.af-dd__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--af-ink);
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Lato', sans-serif;
}
.af-dd__title-ic {
  width: 26px; height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--af-brand-light);
  color: var(--af-brand);
  border-radius: 8px;
  font-size: 11px;
  flex-shrink: 0;
}
.af-dd__count {
  font-size: 12px;
  color: var(--af-ink-2);
  font-weight: 500;
  white-space: nowrap;
  font-family: 'Lato', sans-serif;
}
.af-dd__count b { color: var(--af-brand); font-weight: 700; }

.af-dd__search { position: relative; }
.af-dd__search-input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  font-size: 13px;
  border: 1px solid var(--af-line);
  border-radius: 28px;
  outline: none;
  background: #fff;
  transition: all .2s;
  font-family: 'Lato', sans-serif;
  box-sizing: border-box;
}
.af-dd__search-input:focus {
  border-color: var(--af-brand);
  box-shadow: 0 0 0 3px rgba(14,107,173,0.1);
}
.af-dd__search i {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--af-ink-3);
  pointer-events: none;
}

.af-dd__actions {
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--af-line-2);
  background: #fff;
}
.af-dd__actions button {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border: 1px solid var(--af-line);
  background: #fff;
  color: var(--af-ink-2);
  border-radius: 20px;
  cursor: pointer;
  transition: all .2s;
  font-family: 'Lato', sans-serif;
}
.af-dd__actions button:hover {
  border-color: var(--af-brand);
  color: var(--af-brand);
  background: var(--af-brand-50);
}

.af-dd__list {
  max-height: 340px;
  overflow-y: auto;
  padding: 6px;
}
.af-dd__list::-webkit-scrollbar { width: 6px; }
.af-dd__list::-webkit-scrollbar-track { background: transparent; }
.af-dd__list::-webkit-scrollbar-thumb { background: var(--af-line); border-radius: 6px; }
.af-dd__list::-webkit-scrollbar-thumb:hover { background: var(--af-ink-3); }

.af-dd__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s;
  user-select: none;
}
.af-dd__item:hover { background: var(--af-bg); }
.af-dd__item.checked { background: var(--af-brand-50); }

.af-dd__check {
  width: 18px; height: 18px;
  border: 1.5px solid var(--af-line);
  border-radius: 4px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  background: #fff;
}
.af-dd__item.checked .af-dd__check {
  background: var(--af-brand);
  border-color: var(--af-brand);
}
.af-dd__check::after {
  content: "";
  width: 9px; height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translate(1px, -1px);
  opacity: 0;
  transition: opacity .1s;
}
.af-dd__item.checked .af-dd__check::after { opacity: 1; }

.af-dd__label {
  flex: 1;
  font-size: 13.5px;
  color: var(--af-ink-2);
  line-height: 1.4;
  font-weight: 500;
  font-family: 'Lato', sans-serif;
}
.af-dd__item.checked .af-dd__label { color: var(--af-brand-dark); font-weight: 600; }

.af-dd__badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--af-ink-2);
  background: var(--af-bg);
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 26px;
  text-align: center;
  font-family: 'Lato', sans-serif;
}
.af-dd__item.checked .af-dd__badge {
  background: rgba(14,107,173,0.12);
  color: var(--af-brand-dark);
}

.af-dd__empty {
  padding: 36px 20px;
  text-align: center;
  color: var(--af-ink-3);
  font-size: 13px;
  font-family: 'Lato', sans-serif;
}
.af-dd__empty i {
  font-size: 24px;
  opacity: 0.4;
  margin-bottom: 8px;
  display: block;
}

/* === Skeleton Loader === */
.analysis-page__skeleton {
  display: none;
  gap: 12px;
}
.analysis-page__skeleton.is-active {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.af-skeleton-card {
  background: #fff;
  border: 1px solid var(--af-line-2);
  border-radius: var(--af-radius);
  padding: 16px;
  animation: af-skeleton-pulse 1.5s ease-in-out infinite;
}
@keyframes af-skeleton-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.af-skeleton-line {
  height: 10px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: af-skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 3px;
  margin-bottom: 8px;
}
@keyframes af-skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.af-skeleton-line--short { width: 40%; }
.af-skeleton-line--medium { width: 70%; }
.af-skeleton-line--price { width: 30%; height: 14px; margin-top: 10px; }

/* === Card stagger animation === */
.analysis-page__products .cart-card-small {
  animation: af-card-in 0.3s ease-out;
  animation-fill-mode: both;
}
.analysis-page__products .cart-card-small:nth-child(1) { animation-delay: 0.02s; }
.analysis-page__products .cart-card-small:nth-child(2) { animation-delay: 0.04s; }
.analysis-page__products .cart-card-small:nth-child(3) { animation-delay: 0.06s; }
.analysis-page__products .cart-card-small:nth-child(4) { animation-delay: 0.08s; }
.analysis-page__products .cart-card-small:nth-child(5) { animation-delay: 0.10s; }
.analysis-page__products .cart-card-small:nth-child(6) { animation-delay: 0.12s; }
.analysis-page__products .cart-card-small:nth-child(7) { animation-delay: 0.14s; }
.analysis-page__products .cart-card-small:nth-child(8) { animation-delay: 0.16s; }
.analysis-page__products .cart-card-small:nth-child(9) { animation-delay: 0.18s; }
.analysis-page__products .cart-card-small:nth-child(10) { animation-delay: 0.20s; }
.analysis-page__products .cart-card-small:nth-child(11) { animation-delay: 0.22s; }
.analysis-page__products .cart-card-small:nth-child(12) { animation-delay: 0.24s; }
@keyframes af-card-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === Results === */
.analysis-page__results-container {
  position: relative;
}
.analysis-page__results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.analysis-page__results-count {
  font-size: 13px;
  color: var(--af-ink-2);
}
.analysis-page__results-count strong {
  color: var(--af-ink);
  font-weight: 700;
}
.analysis-page__products {
  position: relative;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.analysis-page__products.is-loading {
  opacity: 0.4;
  pointer-events: none;
}

/* === Sticky Apply Button (Mobile) === */
.analysis-page__sticky-apply {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 16px;
  background: #fff;
  border-top: 1px solid var(--af-line-2);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
  z-index: 100;
}
.analysis-page__sticky-apply .analysis-page__submit-btn {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  border-radius: var(--af-radius-sm);
}

/* === Responsive === */
@media (max-width: 900px) {
  .af-spacer { display: none; }
  .af-search-field { flex: 1 1 100%; order: -1; }
  .af-filter__bar { gap: 6px; }
}
@media (max-width: 768px) {
  .analysis-page__sticky-apply {
    display: block;
  }
}
@media (max-width: 500px) {
  .af-filter__bar { padding: 10px; }
  .af-trigger { padding: 8px 12px; font-size: 12.5px; }
  .af-chip { padding: 6px 10px; font-size: 12px; }
  .af-dd { max-width: calc(100vw - 20px) !important; }
}

/* ============================================================
   ANALYSIS CARD VISUAL ENHANCEMENTS (Senior+)
   Added: 2026-06-08
   ============================================================ */

.cart-card-small {
  background: var(--af-card, #fff);
  border: 1px solid var(--af-line-2, #eee);
  border-radius: var(--af-radius, 17px);
  box-shadow: var(--af-shadow-sm, 0 .25rem 1.25rem 0 rgba(0,0,0,.05));
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  overflow: hidden;
}
.cart-card-small:hover {
  transform: translateY(-2px);
  box-shadow: var(--af-shadow-md, 0 .25rem 1.875rem rgba(0,0,0,.1));
  border-color: rgba(14,107,173,0.2);
}
.cart-card-small__info p:not(.cart-card-small__title-date) {
  color: var(--af-ink-3, #a6a6a6);
  font-size: 12px;
  margin: 0;
}
.cart-card-small__info .cart-card-small__title-date,
.cart-card-small__info p:last-child {
  font-weight: 700;
  color: var(--af-accent, #dd2a1b);
  font-size: 16px;
}
.cart-card-small__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.cart-card-small__details {
  flex: 1 1 auto;
  text-align: center;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--af-brand, #0e6bad);
  border: 1px solid var(--af-brand, #0e6bad);
  border-radius: var(--af-pill, 33px);
  background: transparent;
  transition: all .2s ease;
  text-decoration: none;
  white-space: nowrap;
}
.cart-card-small__details:hover {
  background: var(--af-brand, #0e6bad);
  color: #fff;
}
.cart-card-small__actions .button--icon-cart {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
@media (max-width: 768px) {
  .cart-card-small {
    border-radius: 12px;
    margin-bottom: 12px;
  }
  .cart-card-small__details {
    flex: 1 1 50%;
    padding: 10px 12px;
    font-size: 13px;
  }
  .cart-card-small__actions .button--icon-cart {
    flex: 0 0 44px;
  }
  .cart-card-small__title a {
    font-size: 15px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

/* ===== Rubric description block ===== */
.af-rubric-desc{
  display:none;
  margin:0 0 24px;
  padding:20px 24px;
  background:#f7f9fb;
  border-radius:12px;
  font-size:15px;
  line-height:1.65;
  color:#333;
}
.af-rubric-desc.is-visible{display:block;animation:afDescFade .25s ease}
.af-rubric-desc h2{font-size:22px;margin:0 0 12px}
.af-rubric-desc h3{font-size:17px;margin:16px 0 8px}
.af-rubric-desc p{margin:0 0 12px}
.af-rubric-desc ul,.af-rubric-desc ol{margin:0 0 12px;padding-left:20px}
.af-rubric-desc img{max-width:100%;height:auto;border-radius:8px;margin:8px 0}
@keyframes afDescFade{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}
