/* ===================================================================
   Cadibo Product Filters — Frontend Styles
   =================================================================== */

/* ── Variabile brand ── */
.cpf-sidebar {
  --cpf-primary:     #002153;
  --cpf-primary-lt:  #e8eef8;
  --cpf-border:      #e5e7eb;
  --cpf-bg:          #ffffff;
  --cpf-bg-hover:    #f9fafb;
  --cpf-text:        #111827;
  --cpf-text-muted:  #6b7280;
  --cpf-count-bg:    #f3f4f6;
  --cpf-radius-card: 10px;
  --cpf-radius-sm:   6px;
  --cpf-shadow:      0 1px 4px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --cpf-transition:  0.15s ease;

  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--cpf-text);
}

/* ── Reset local ── */
.cpf-sidebar *,
.cpf-sidebar *::before,
.cpf-sidebar *::after {
  box-sizing: border-box;
}

/* ===================================================================
   HEADER SIDEBAR
   =================================================================== */
.cpf-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 10px;
}

.cpf-sidebar-title {
  font-size: 11px !important;
  font-weight: 700 !important;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cpf-text) !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  background: none !important;
}

.cpf-reset-btn {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--cpf-primary);
  text-decoration: none;
  border: 1.5px solid var(--cpf-primary);
  border-radius: 5px;
  padding: 3px 9px;
  white-space: nowrap;
  transition: background var(--cpf-transition), color var(--cpf-transition);
  flex-shrink: 0;
}

.cpf-reset-btn:hover {
  background: var(--cpf-primary);
  color: #fff;
  text-decoration: none;
}

/* ===================================================================
   CARD FILTRU (accordion)
   =================================================================== */
.cpf-filter {
  background: var(--cpf-bg);
  border: 1px solid var(--cpf-border);
  border-radius: var(--cpf-radius-card);
  margin-bottom: 8px;
  box-shadow: var(--cpf-shadow);
  overflow: hidden;
  transition: border-color var(--cpf-transition);
}

.cpf-filter:last-child {
  margin-bottom: 0;
}

/* ── Header accordion ── */
.cpf-filter-header {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 13px 15px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  gap: 8px;
  transition: background var(--cpf-transition);
  line-height: 1;
}

.cpf-filter-header:hover {
  background: var(--cpf-bg-hover);
}

.cpf-filter-label {
  font-size: 14px;
  font-weight: 700;
  text-transform: capitalize;
  color: var(--cpf-text);
  flex: 1;
  text-align: left;
}

.cpf-active-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: var(--cpf-primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 50%;
  flex-shrink: 0;
}

.cpf-filter-arrow {
  flex-shrink: 0;
  color: #9ca3af;
  transition: transform 0.22s ease;
  display: block;
}

.cpf-filter.is-open .cpf-filter-arrow {
  transform: rotate(180deg);
}

/* ── Body accordion ── */
.cpf-filter-body {
  padding: 2px 15px 14px;
  border-top: 1px solid #f3f4f6;
}

/* ===================================================================
   LISTA TERMENI — baza comuna
   =================================================================== */
.cpf-terms {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}

.cpf-term {
  padding: 0;
}

/* ===================================================================
   TIP: CHECKBOX (default)
   =================================================================== */
.cpf-terms--checkbox .cpf-term-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 2px;
  text-decoration: none;
  color: var(--cpf-text);
  font-size: 15px;
  border-radius: var(--cpf-radius-sm);
  transition: color var(--cpf-transition);
}

.cpf-terms--checkbox .cpf-term-link:hover {
  color: var(--cpf-primary);
  text-decoration: none;
}

.cpf-checkbox {
  width: 17px;
  height: 17px;
  border: 2px solid #d1d5db;
  border-radius: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--cpf-transition), background var(--cpf-transition);
  background: #fff;
}

.cpf-terms--checkbox .cpf-term.is-active .cpf-checkbox,
.cpf-terms--color   .cpf-term.is-active .cpf-checkbox {
  background: var(--cpf-primary);
  border-color: var(--cpf-primary);
  color: #fff;
}

.cpf-term-name {
  flex: 1;
  line-height: 1.3;
}

.cpf-count {
  font-size: 11px;
  color: var(--cpf-text-muted);
  background: var(--cpf-count-bg);
  padding: 1px 7px;
  border-radius: 12px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.cpf-term.is-active .cpf-count {
  background: var(--cpf-primary-lt);
  color: var(--cpf-primary);
}

/* ===================================================================
   TIP: COLOR (swatches)
   =================================================================== */
.cpf-terms--color .cpf-term-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 2px;
  text-decoration: none;
  color: var(--cpf-text);
  font-size: 13px;
  border-radius: var(--cpf-radius-sm);
  transition: color var(--cpf-transition);
}

.cpf-terms--color .cpf-term-link:hover {
  color: var(--cpf-primary);
  text-decoration: none;
}

.cpf-color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
  transition: box-shadow var(--cpf-transition);
}

.cpf-terms--color .cpf-term.is-active .cpf-color-swatch {
  border-color: var(--cpf-primary);
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--cpf-primary);
}

.cpf-terms--color .cpf-term-link:hover .cpf-color-swatch {
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px #9ca3af;
}

/* Swatch alb — bordura vizibila */
.cpf-color-swatch[style*="background:#fff"],
.cpf-color-swatch[style*="background:#ffffff"],
.cpf-color-swatch[style*="background: #fff"],
.cpf-color-swatch[style*="background: #ffffff"] {
  border-color: #d1d5db;
}

/* ===================================================================
   TIP: SIZE (pills multiselect)
   =================================================================== */
.cpf-terms--size {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.cpf-size-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 36px;
  padding: 0 10px;
  border: 1.5px solid var(--cpf-border);
  border-radius: 7px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  text-decoration: none;
  background: #fff;
  line-height: 1;
  white-space: nowrap;
  transition: border-color var(--cpf-transition),
              background var(--cpf-transition),
              color var(--cpf-transition);
}

.cpf-size-btn:hover {
  border-color: var(--cpf-primary);
  color: var(--cpf-primary);
  text-decoration: none;
}

.cpf-terms--size .cpf-term.is-active .cpf-size-btn {
  border-color: var(--cpf-primary);
  background: var(--cpf-primary);
  color: #fff;
}

/* ===================================================================
   FILTRU PRET
   =================================================================== */
.cpf-price-form {
  padding-top: 10px;
}

.cpf-price-inputs {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 12px;
}

.cpf-price-field {
  flex: 1;
  min-width: 0;
}

.cpf-price-field label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--cpf-text-muted);
  margin-bottom: 5px;
}

.cpf-price-input-wrap {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--cpf-border);
  border-radius: 7px;
  overflow: hidden;
  background: #fff;
  transition: border-color var(--cpf-transition);
}

.cpf-price-input-wrap:focus-within {
  border-color: var(--cpf-primary);
}

.cpf-currency {
  padding: 0 7px;
  display: flex;
  align-items: center;
  font-size: 12px;
  color: var(--cpf-text-muted);
  background: #f9fafb;
  border-right: 1px solid var(--cpf-border);
  flex-shrink: 0;
  white-space: nowrap;
}

.cpf-price-input-wrap input[type="number"] {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  width: 100%;
  padding: 8px 8px;
  font-size: 13px;
  background: transparent;
  color: var(--cpf-text);
  -moz-appearance: textfield;
  min-width: 0;
}

.cpf-price-input-wrap input[type="number"]::-webkit-outer-spin-button,
.cpf-price-input-wrap input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.cpf-price-sep {
  flex-shrink: 0;
  color: var(--cpf-text-muted);
  line-height: 36px;
  padding-bottom: 2px;
}

.cpf-price-apply {
  display: block;
  width: 100%;
  padding: 10px;
  background: var(--cpf-primary);
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background var(--cpf-transition);
}

.cpf-price-apply:hover {
  background: #003580;
}

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

/* Tablet: sidebar pe orizontal (daca este deasupra grilei) */
@media (max-width: 900px) {
  .cpf-terms--size {
    gap: 5px;
  }

  .cpf-size-btn {
    min-width: 34px;
    height: 32px;
    padding: 0 8px;
    font-size: 11px;
  }
}

/* Mobile: sidebar la top */
@media (max-width: 600px) {
  .cpf-sidebar {
    margin-bottom: 24px;
  }

  .cpf-filter-header {
    padding: 12px 14px;
  }

  .cpf-filter-body {
    padding: 2px 14px 13px;
  }

  .cpf-price-inputs {
    flex-direction: column;
    gap: 10px;
  }

  .cpf-price-sep {
    display: none;
  }

  .cpf-price-field {
    width: 100%;
  }
}

/* ===================================================================
   MOBILE DRAWER — toggle button (ascuns pe desktop)
   =================================================================== */
.cpf-mobile-open-btn {
  display: none;
}

/* ===================================================================
   OVERLAY
   =================================================================== */
.cpf-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 6000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.cpf-drawer-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

/* ===================================================================
   DRAWER PANEL
   =================================================================== */
.cpf-drawer {
  --cpf-primary:     #002153;
  --cpf-primary-lt:  #e8eef8;
  --cpf-border:      #e5e7eb;
  --cpf-bg:          #ffffff;
  --cpf-bg-hover:    #f9fafb;
  --cpf-text:        #111827;
  --cpf-text-muted:  #6b7280;
  --cpf-count-bg:    #f3f4f6;
  --cpf-radius-card: 10px;
  --cpf-radius-sm:   6px;
  --cpf-shadow:      0 1px 4px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --cpf-transition:  0.15s ease;

  position: fixed;
  top: 0;
  left: 0;
  width: 85vw;
  max-width: 380px;
  height: 100%;
  height: 100dvh;
  background: #fff;
  z-index: 6100;
  transform: translateX(-100%);
  visibility: hidden;
  transition: transform 0.28s ease, visibility 0.28s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.18);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--cpf-text);
}

.cpf-drawer *,
.cpf-drawer *::before,
.cpf-drawer *::after {
  box-sizing: border-box;
}

.cpf-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
}

/* ── Drawer header (sticky) ── */
.cpf-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--cpf-border);
  flex-shrink: 0;
  background: #fff;
}

.cpf-drawer-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--cpf-text);
  letter-spacing: 0.02em;
}

.cpf-drawer-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: #f3f4f6;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: var(--cpf-text);
  transition: background var(--cpf-transition);
  flex-shrink: 0;
}

.cpf-drawer-close:hover {
  background: #e5e7eb;
}

/* ── Drawer body (scrollabil) ── */
.cpf-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  -webkit-overflow-scrolling: touch;
}

/* ── Drawer footer (sticky) ── */
.cpf-drawer-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border-top: 1px solid var(--cpf-border);
  flex-shrink: 0;
  background: #fff;
}

.cpf-drawer-apply {
  display: block;
  width: 100%;
  padding: 13px;
  background: var(--cpf-primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background var(--cpf-transition);
}

.cpf-drawer-apply:hover {
  background: #003580;
}

.cpf-drawer-reset-btn {
  display: block;
  width: 100%;
  padding: 11px;
  background: transparent;
  color: var(--cpf-primary);
  border: 1.5px solid var(--cpf-primary);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: background var(--cpf-transition), color var(--cpf-transition);
}

.cpf-drawer-reset-btn:hover {
  background: var(--cpf-primary);
  color: #fff;
}

/* ── Butoane termeni in drawer (inlocuiesc <a>) ── */
.cpf-m-term {
  background: transparent;
  border: none;
  padding: 0;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
  line-height: inherit;
}

/* ===================================================================
   BREAKPOINT MOBIL — sub 1024px: ascunde sidebar, arata buton drawer
   =================================================================== */
@media (max-width: 1024px) {
  .cpf-sidebar {
    display: none !important;
  }

  .cpf-mobile-open-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: #002153;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 16px;
    transition: background 0.15s ease;
  }

  .cpf-mobile-open-btn:hover {
    background: #003580;
  }

  .cpf-m-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    background: #fff;
    color: #002153;
    font-size: 11px;
    font-weight: 700;
    border-radius: 10px;
  }
}

/* Body scroll lock când drawer-ul e deschis */
body.cadibo-filter-open {
  overflow: hidden !important;
}
