/* =============================================
   MODERN CARD COMPARISON SYSTEM
   ============================================= */

/* ---- QUICK FILTER BUTTONS ---- */
.quick-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}

.quick-filters label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 4px;
}

.qfilter-btn {
  padding: 8px 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-solid);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.qfilter-btn:hover { color: var(--text); border-color: var(--border-light); }
.qfilter-btn.active { background: var(--green); color: #000; border-color: var(--green); font-weight: 700; }

/* ---- VIEW PRESET CARDS ---- */
.view-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.view-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-solid);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.view-card:hover { border-color: var(--border-light); background: rgba(255,255,255,0.02); }
.view-card.active { border-color: var(--green); background: rgba(34,197,94,0.06); }

.view-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.vc-all { background: rgba(34,197,94,0.15); color: var(--green); }
.vc-pricing { background: rgba(96,165,250,0.15); color: #60A5FA; }
.vc-rules { background: rgba(245,166,35,0.15); color: var(--amber); }
.vc-trust { background: rgba(168,85,247,0.15); color: #A855F7; }

.view-card-title { font-size: 0.82rem; font-weight: 700; color: var(--text); }
.view-card.active .view-card-title { color: var(--green); }
.view-card-desc { font-size: 0.68rem; color: var(--muted); line-height: 1.4; margin-top: 2px; }

/* ---- TOOLBAR ---- */
.compare-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
}

.toolbar-left { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.result-count {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
}

.result-count strong {
  color: var(--green);
  font-weight: 700;
}

/* ---- FILTER CHIPS ---- */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.filter-chip {
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-solid);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.filter-chip:hover {
  border-color: var(--border-light);
  color: var(--text);
}

.filter-chip.active {
  background: var(--green-dim);
  color: var(--green);
  border-color: rgba(34,197,94,0.3);
}

.filter-chip .arrow {
  font-size: 0.6rem;
  transition: transform 0.2s;
}

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

/* Filter dropdown */
.filter-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 180px;
  background: var(--panel-solid);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 6px;
  z-index: 50;
  box-shadow: var(--shadow-lg);
  display: none;
}

.filter-dropdown.show { display: block; animation: dropIn 0.15s ease; }

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.filter-option {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-option:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.filter-option.selected { color: var(--green); background: var(--green-dim); }

.filter-option .check {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1.5px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  flex-shrink: 0;
  transition: all 0.15s;
}

.filter-option.selected .check {
  background: var(--green);
  border-color: var(--green);
  color: #000;
}

/* Active filter tags */
.active-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.active-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--green-dim);
  color: var(--green);
  font-size: 0.7rem;
  font-weight: 600;
  border: 1px solid rgba(34,197,94,0.15);
}

.active-tag .x {
  cursor: pointer;
  opacity: 0.6;
  font-size: 0.8rem;
  transition: opacity 0.15s;
}

.active-tag .x:hover { opacity: 1; }

/* ---- FIRM CARDS ---- */
.firm-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.firm-card-row {
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
  position: relative;
}

.firm-card-row::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 3px;
  background: var(--green);
  opacity: 0;
  transition: opacity 0.2s;
  border-radius: 3px 0 0 3px;
}

.firm-card-row:hover {
  border-color: var(--border-hover);
  box-shadow: 0 4px 24px rgba(0,0,0,0.2), 0 0 40px rgba(34,197,94,0.04);
}

.firm-card-row:hover::before { opacity: 1; }

/* Card main content */
.card-main {
  display: grid;
  grid-template-columns: 240px 1fr auto;
  gap: 0;
  align-items: stretch;
}

/* Left: Firm identity */
.card-identity {
  padding: 20px 24px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100px;
}

.card-rank {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.card-rank.top-3 { color: var(--green); }

.card-name {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.card-name a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.15s;
}

.card-name a:hover { color: var(--green); }

.card-badges {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.card-rating {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 0.78rem;
}

.card-rating .stars { color: var(--amber); font-weight: 700; }
.card-rating .count { color: var(--muted); font-size: 0.72rem; }

/* Center: Key metrics */
.card-metrics {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  align-items: stretch;
}

.metric {
  padding: 16px 14px;
  text-align: center;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: background 0.15s;
}

.metric:last-child { border-right: none; }

.metric:hover { background: rgba(255,255,255,0.015); }

.metric .value {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 2px;
}

.metric .value.green { color: var(--green); }
.metric .value.amber { color: var(--amber); }
.metric .value.white { color: var(--text); }

.metric .label {
  font-size: 0.58rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* Price metric special */
.metric.price-metric .value {
  font-size: 1.2rem;
  color: var(--green);
}

/* Right: CTA and expand */
.card-actions {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  min-width: 140px;
}

.card-cta {
  display: block;
  text-align: center;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  background: var(--gradient-green);
  color: #000;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(34,197,94,0.2);
}

.card-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(34,197,94,0.3);
}

.card-expand {
  text-align: center;
  padding: 6px;
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.card-expand:hover {
  border-color: var(--green);
  color: var(--green);
}

/* ---- EXPANDED DETAILS ---- */
.card-details {
  display: none;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.1);
}

.card-details.show { display: block; animation: slideDown 0.25s ease; }

@keyframes slideDown {
  from { opacity: 0; }
  to { opacity: 1; }
}

.card-details-inner {
  padding: 14px 16px;
}

/* Card-based section layout */
.detail-section-card {
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}

/* 2x2 grid layout for sections */
.detail-sections-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

@media (max-width: 900px) {
  .detail-sections-grid {
    grid-template-columns: 1fr;
  }
}

.detail-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.detail-section-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.detail-section-icon.dsi-pricing { background: rgba(96,165,250,0.15); color: #60A5FA; }
.detail-section-icon.dsi-rules { background: rgba(245,166,35,0.15); color: var(--amber); }
.detail-section-icon.dsi-payouts { background: rgba(168,85,247,0.15); color: #A855F7; }
.detail-section-icon.dsi-company { background: rgba(34,197,94,0.15); color: var(--green); }

.detail-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.detail-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 6px 10px;
}

.detail-item {
  padding: 6px 10px;
  background: rgba(255,255,255,0.02);
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.04);
}

.detail-item .dlabel {
  font-size: 0.6rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
  font-weight: 600;
}

.detail-item .dvalue {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

/* ---- FEATURE STRIP ---- */
.card-features {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0 24px 16px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 0;
}

.feature-tag {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.feature-tag.yes { background: var(--green-dim); color: var(--green); }
.feature-tag.no { background: rgba(239,68,68,0.08); color: var(--red); }
.feature-tag.neutral { background: rgba(100,116,139,0.1); color: var(--muted); }

/* ---- RESPONSIVE ---- */
@media (max-width: 1024px) {
  .card-main {
    grid-template-columns: 1fr;
  }

  .card-identity {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 16px 20px;
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }

  .card-rank { margin-bottom: 0; }

  .card-metrics {
    grid-template-columns: repeat(5, 1fr);
    padding: 0;
  }

  .card-actions {
    flex-direction: row;
    min-width: unset;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
  }

  .card-cta { flex: 1; }
  .card-expand { width: auto; padding: 6px 16px; }

  .view-presets { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .card-metrics {
    grid-template-columns: repeat(3, 1fr);
  }

  .metric:nth-child(3) { border-right: none; }
  .metric:nth-child(n+4) {
    border-top: 1px solid var(--border);
  }

  .compare-toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-right { margin-left: 0; justify-content: space-between; }

  .view-presets { grid-template-columns: 1fr 1fr; }
  .view-card-desc { display: none; }
  .quick-filters { flex-wrap: wrap; }

  .detail-fields { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 4px 8px; }
  .detail-section-card { padding: 10px 12px; }
  .detail-sections-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .card-metrics { grid-template-columns: repeat(2, 1fr); }
  .metric:nth-child(odd) { border-right: none; }
  .metric:nth-child(n+3) { border-top: 1px solid var(--border); }
  .metric:last-child { border-right: none; }

  .view-presets { grid-template-columns: 1fr; }
  .filter-row { gap: 6px; }
  .filter-chip { padding: 6px 12px; font-size: 0.7rem; }
}