/* ── Stock Broker Explorer Styles ──
   Brand palette: Deep navy (#0f172a) + Vibrant Purple (#7c3aed) + Emerald (#059669)
   ──────────────────────────────────────────────────────────────────── */

body { background: var(--background, #fff); }
.layout-container { display: flex; flex: 1; }

/* ── Sidebar ── */
[data-sidebar] {
  width: 220px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid #e5e0f0;
  padding: 1.5rem 1rem;
  overflow-y: auto;
}
[data-sidebar] header {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7c3aed;
  margin: 1.25rem 0 0.5rem;
}
[data-sidebar] header:first-child { margin-top: 0; }
[data-sidebar] ul { list-style: none; padding: 0; margin: 0 0 0.5rem; }
[data-sidebar] ul li { margin: 0; }
[data-sidebar] ul li a {
  display: block;
  padding: 0.375rem 0.625rem;
  border-radius: 6px;
  font-size: 0.8125rem;
  color: #4b5563;
  text-decoration: none;
  transition: background 0.1s;
}
[data-sidebar] ul li a:hover { background: #f5f3ff; color: #7c3aed; }
[data-sidebar] ul li a[aria-current="page"] {
  background: #f5f3ff;
  color: #7c3aed;
  font-weight: 600;
}
.close-sidebar-btn { display: none; }

main { flex: 1; padding: 2rem; min-width: 0; }

/* ── Hero search section ── */
.hero-search {
  background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
  border: 1px solid #e5e5e5;
  border-radius: 16px;
  padding: 2.5rem 2rem;
  margin-bottom: 2rem;
  text-align: center;
}
.hero-search h1 {
  font-size: 1.875rem;
  font-weight: 800;
  margin: 0 0 0.375rem;
  color: #0f172a;
  letter-spacing: -0.025em;
}
.hero-search p {
  font-size: 0.9375rem;
  color: #6b7280;
  margin: 0 0 1.5rem;
}
.hero-search-inner {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.search-input-wrap {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid #d4d0e0;
  border-radius: 12px;
  padding: 0.5rem 0.75rem 0.5rem 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input-wrap:focus-within {
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}
.search-input-wrap .search-icon { color: #9ca3af; flex-shrink: 0; margin-right: 0.625rem; }
.search-input-wrap input {
  border: none; background: transparent; outline: none;
  font-size: 0.9375rem; padding: 0.375rem 0; flex: 1; min-width: 0;
}
.search-input-wrap .clear-btn {
  background: none; border: none; color: #9ca3af; cursor: pointer;
  padding: 0.25rem; display: none; flex-shrink: 0;
}
.search-input-wrap .clear-btn.visible { display: block; }
.search-input-wrap .clear-btn:hover { color: #6b7280; }

/* ── Pill filter chips ── */
.filter-chips {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}
.filter-chip {
  display: inline-flex; align-items: center; gap: 0.375rem;
  padding: 0.375rem 0.875rem; border-radius: 999px;
  font-size: 0.8125rem; font-weight: 500;
  border: 1px solid #e5e5e5; background: #fff; color: #4b5563;
  cursor: pointer; transition: all 0.12s; user-select: none;
}
.filter-chip:hover { border-color: #d4d4d4; background: #fafafa; }
.filter-chip.active { border-color: #7c3aed; background: #7c3aed; color: #fff; }
.filter-chip svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ── Results bar ── */
.results-bar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.25rem; font-size: 0.8125rem; color: #6b7280;
}
.results-bar .cmp-link {
  display: inline-flex; align-items: center; gap: 0.375rem;
  text-decoration: none; color: #7c3aed; font-weight: 600; font-size: 0.8125rem;
}
.results-bar .cmp-link:hover { text-decoration: underline; }
.cmp-badge {
  display: none; background: #7c3aed; color: #fff;
  border-radius: 999px; padding: 0 6px; font-size: 0.6875rem;
  line-height: 1.5; min-width: 18px; text-align: center;
}

/* ── Broker card grid ── */
.broker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
@media (max-width: 1200px) { .broker-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px)  { .broker-grid { grid-template-columns: repeat(2, 1fr); gap: 0.875rem; } }
@media (max-width: 480px)  { .broker-grid { grid-template-columns: 1fr; gap: 0.75rem; } }

.broker-card {
  background: #fff;
  border: 1px solid #e5e0f0;
  border-radius: 16px;
  padding: 1.25rem 1.25rem 0;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.2s, transform 0.2s;
  text-decoration: none;
  color: inherit;
  position: relative;
  height: 100%;
}
.broker-card:hover {
  border-color: #c4b5fd;
  box-shadow: 0 8px 28px rgba(124, 58, 237, 0.08);
  transform: translateY(-2px);
}
.broker-card.featured {
  border-color: #c4b5fd;
  background: linear-gradient(135deg, #fff 0%, #faf5ff 100%);
}
.broker-card.featured::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #7c3aed, #059669);
  border-radius: 16px 16px 0 0;
}

/* Card header: type tag in top-right */
.broker-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.625rem;
}

.broker-card .broker-name {
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.3;
  color: #0f172a;
  margin-bottom: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Three metadata rows ── */
.broker-card .meta-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: #6b7280;
  padding: 0.375rem 0;
  border-bottom: 1px solid #f3f0ff;
}
.broker-card .meta-row:last-of-type { border-bottom: none; }
.broker-card .meta-row svg {
  width: 15px; height: 15px; flex-shrink: 0;
  color: #9ca3af;
}
.broker-card .meta-row .meta-value { font-weight: 500; color: #374151; }
.broker-card .meta-row .meta-muted { color: #9ca3af; }

/* ── Card actions ── */
.broker-card .card-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  margin-top: auto;
}
.compare-check {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: #6b7280;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.compare-check input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 16px; height: 16px;
  border: 1.5px solid #d4d0e0;
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  transition: all 0.12s;
  flex-shrink: 0;
}
.compare-check input[type="checkbox"]:checked {
  background: #7c3aed;
  border-color: #7c3aed;
}
.compare-check input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 2px; left: 5px;
  width: 4px; height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.compare-check input[type="checkbox"]:hover { border-color: #7c3aed; }

.view-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.625rem 0.75rem;
  border-radius: 10px;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: #7c3aed;
  color: #fff;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s;
  min-height: 42px;
}
.view-btn:hover { background: #6d28d9; }
.view-btn svg { width: 14px; height: 14px; }

/* ── Type tags ── */
.type-tag {
  display: inline-block;
  padding: 0.2rem 0.625rem;
  border-radius: 6px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.type-tag.discount { background: #f5f3ff; color: #7c3aed; }
.type-tag.full-service { background: #f0fdf4; color: #059669; }
.type-tag.bank-backed { background: #fffbeb; color: #d97706; }
.type-tag.neo { background: #faf5ff; color: #7c3aed; }
.type-tag.institutional { background: #fdf2f8; color: #db2777; }
.type-tag.nse-registered { background: #f3f4f6; color: #6b7280; }

/* ── Loading / empty ── */
.loading {
  text-align: center; padding: 3rem 2rem;
  color: #9ca3af; font-size: 0.875rem; grid-column: 1 / -1;
}

/* ── Pagination ── */
.pagination { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid #e5e0f0; }
.pagination-inner { display: flex; align-items: center; justify-content: center; gap: 0.375rem; flex-wrap: wrap; }
.page-btn {
  padding: 0.375rem 0.75rem; border: 1px solid #e5e0f0; border-radius: 8px;
  background: #fff; color: #4b5563; font-size: 0.8125rem;
  font-weight: 500; cursor: pointer; transition: all 0.12s;
}
.page-btn:hover:not(:disabled) { border-color: #c4b5fd; color: #7c3aed; background: #f5f3ff; }
.page-btn.active { background: #7c3aed; color: #fff; border-color: #7c3aed; }
.page-btn:disabled { opacity: 0.4; cursor: default; }
.page-ellipsis { padding: 0.375rem 0.25rem; color: #9ca3af; font-size: 0.8125rem; }
.page-info { margin-left: 0.75rem; font-size: 0.75rem; color: #9ca3af; }

/* ── Compare bar ── */
.compare-bar {
  position: fixed; bottom: 0; left: 0; right: 0; background: #fff;
  border-top: 1px solid #e5e0f0; box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
  z-index: 1000; padding: 0.75rem 1.25rem;
  display: none; align-items: center; gap: 0.75rem; flex-wrap: wrap;
}
.compare-bar.visible { display: flex; }
.compare-bar .cb-label { font-size: 0.8125rem; font-weight: 700; color: #0f172a; white-space: nowrap; }
.compare-bar .cb-cards { display: flex; gap: 0.5rem; flex: 1; min-width: 0; overflow-x: auto; padding: 0.125rem 0; }
.compare-bar .cb-card {
  display: flex; align-items: center; gap: 0.375rem;
  padding: 0.375rem 0.625rem; background: #f5f3ff;
  border-radius: 6px; font-size: 0.75rem; font-weight: 500; white-space: nowrap;
}
.compare-bar .cb-card .cb-remove { background: none; border: none; cursor: pointer; padding: 0; font-size: 1rem; line-height: 1; color: #9ca3af; }
.compare-bar .cb-card .cb-remove:hover { color: #ef4444; }
.compare-bar .cb-actions { display: flex; gap: 0.5rem; align-items: center; }
.compare-bar .cb-clear {
  background: none; border: 1px solid #e5e0f0; border-radius: 8px;
  padding: 0.5rem 0.75rem; font-size: 0.75rem; font-weight: 500;
  cursor: pointer; color: #6b7280; transition: all 0.12s;
}
.compare-bar .cb-clear:hover { border-color: #fca5a5; color: #ef4444; }
.compare-bar .cb-compare {
  padding: 0.5rem 1rem; font-size: 0.75rem; font-weight: 600;
  border: none; border-radius: 8px; background: #7c3aed; color: #fff;
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 0.375rem; transition: background 0.12s;
}
.compare-bar .cb-compare:hover { background: #6d28d9; }
.compare-bar .cb-compare:disabled { opacity: 0.5; cursor: default; }

main { padding-bottom: 72px; }
@media (max-width: 768px) {
  .hero-search { padding: 1.5rem 1rem; }
  .hero-search h1 { font-size: 1.375rem; }
  .broker-grid { gap: 0.875rem; }
  .compare-bar { padding: 0.5rem 0.75rem; gap: 0.5rem; }
  .view-btn { min-height: 48px; font-size: 0.8125rem; }

  /* ── Off-canvas section sidebar ── */
  .layout-container { display: block; }
  [data-sidebar] {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 240px; max-width: 85vw;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.1);
  }
  [data-sidebar].mobile-open { transform: translateX(0); }
  [data-sidebar] .close-sidebar-btn {
    display: inline-flex;
    align-items: center; justify-content: center;
    width: 32px; height: 32px;
    position: absolute; top: 0.75rem; right: 0.75rem;
    border: 1px solid #e5e0f0; border-radius: 8px;
    background: #fff; color: #6b7280; cursor: pointer; z-index: 2;
  }
  [data-sidebar] .close-sidebar-btn:hover { color: #374151; border-color: #c4b5fd; }
}
@media (max-width: 480px) {
  .hero-search h1 { font-size: 1.25rem; }
  .hero-search p { font-size: 0.8125rem; }
}

/* ════════════════════════════════════════════
   CARDS-INSPIRED PATTERNS (shared with detail/compare)
   ════════════════════════════════════════════ */

.section-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.section-heading h2 { font-size: 17px; font-weight: 700; margin: 0; }
.icon-box {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px;
  background: #f5f3ff; color: #7c3aed; flex-shrink: 0;
}
.icon-box svg { width: 18px; height: 18px; stroke-width: 2; }
.section-subtitle { font-size: 13px; color: #6b7280; margin-top: -8px; margin-bottom: 16px; }

.hero-card { margin-bottom: 20px; padding: 24px; background: #fff; border: 1px solid #e5e0f0; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.hero-card-title { font-size: 26px; font-weight: 700; line-height: 1.2; margin-bottom: 10px; }
.hero-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 12px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.pill-light { background: #f5f3ff; color: #7c3aed; }
.pill-success { background: #f0fdf4; color: #059669; }
.pill-amber { background: #fffbeb; color: #d97706; }
.highlight-banner { padding: 10px 14px; background: #f5f3ff; border: 1px solid #c4b5fd; border-radius: 8px; color: #7c3aed; font-size: 14px; font-weight: 600; margin-bottom: 14px; }
.hero-disclaimer { text-align: center; font-size: 12px; color: #9ca3af; margin-top: 16px; padding-top: 12px; border-top: 1px solid #e5e0f0; }

.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 10px; margin-bottom: 20px; }
.stat-box { background: #f9f9ff; border: 1px solid #e5e0f0; border-radius: 10px; padding: 10px 12px; text-align: center; }
.stat-box .stat-value { font-size: 17px; font-weight: 700; }
.stat-box .stat-value.green { color: #059669; }
.stat-box .stat-label { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: #6b7280; font-weight: 600; margin-top: 2px; }

.detail-grid { display: grid; grid-template-columns: 1fr 340px; gap: 20px; }
@media (max-width: 1024px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-card { background: #fff; border: 1px solid #e5e0f0; border-radius: 12px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.detail-card + .detail-card { margin-top: 16px; }

.benefits-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.benefit-item { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; line-height: 1.4; }
.benefit-item .check-icon { color: #059669; flex-shrink: 0; margin-top: 2px; }
.benefit-item .check-icon svg { width: 14px; height: 14px; stroke-width: 3; }

.features-row { display: flex; flex-wrap: wrap; gap: 8px; }
.feature-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; font-size: 12px; font-weight: 600; transition: all 0.12s; }
.feature-chip.yes { background: #f5f3ff; color: #7c3aed; border: 1px solid #c4b5fd; }
.feature-chip.no { background: #f9f9ff; color: #9ca3af; border: 1px solid transparent; }
.feature-chip svg { width: 14px; height: 14px; }

.info-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid #e5e0f0; font-size: 13px; }
.info-row:last-of-type { border-bottom: none; }
.info-row .ir-label { color: #6b7280; }
.info-row .ir-value { font-weight: 600; }

.fee-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.fee-table tr { border-bottom: 1px solid #e5e0f0; }
.fee-table tr:last-child { border-bottom: none; }
.fee-table td { padding: 10px 0; }
.fee-table td:last-child { text-align: right; font-weight: 600; }

.pros-cons-section h3 { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.pros-cons-section h3.green { color: #059669; }
.pros-cons-section h3.red { color: #ef4444; }
.pros-cons-section ul { margin-bottom: 14px; list-style: none; padding: 0; }
.pros-cons-section li { display: flex; align-items: flex-start; gap: 6px; font-size: 13px; padding: 4px 0; line-height: 1.4; }
.pros-cons-section li svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 2px; }
.pros-cons-section li .check { color: #059669; }
.pros-cons-section li .cross { color: #ef4444; }
.pros-cons-divider { height: 1px; background: #e5e0f0; margin: 10px 0; }

.btn-primary { display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px; background: #7c3aed; color: #fff; border-radius: 8px; font-size: 13px; font-weight: 600; transition: background 0.15s; white-space: nowrap; text-decoration: none; border: none; cursor: pointer; }
.btn-primary:hover { background: #6d28d9; }
.btn-primary svg { width: 16px; height: 16px; }
.btn-outline { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; border: 1px solid #e5e0f0; background: transparent; color: inherit; transition: border-color 0.15s; white-space: nowrap; text-decoration: none; cursor: pointer; }
.btn-outline:hover { border-color: #7c3aed; color: #7c3aed; }

.empty-state { padding: 20px; text-align: center; border: 1px dashed #e5e0f0; border-radius: 10px; background: #fafafc; }
.empty-state p { font-size: 13px; color: #6b7280; margin-bottom: 12px; }
.empty-state-box { padding: 14px; background: #f9f9ff; border-radius: 8px; font-size: 13px; color: #6b7280; text-align: center; }

.compare-wrapper {
  overflow: auto;
  max-height: calc(100vh - 160px);
  border: 1px solid #e5e0f0;
  border-radius: 12px;
}
.compare-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; min-width: 600px; }
.compare-table thead { position: sticky; top: 0; z-index: 10; }
.compare-table thead th { background: #f9f9ff; }
.compare-table th, .compare-table td { padding: 0.625rem 0.75rem; border: 1px solid #e5e0f0; text-align: center; vertical-align: top; }
.compare-table th { background: #f9f9ff; font-weight: 600; min-width: 140px; }
.compare-table td:first-child { text-align: left; font-weight: 500; background: #f9f9ff; white-space: nowrap; position: sticky; left: 0; z-index: 5; }
.compare-table thead th:first-child { position: sticky; left: 0; z-index: 11; }
.compare-table .broker-col { min-width: 200px; }
.compare-table .broker-col .broker-name { font-weight: 600; font-size: 0.875rem; display: block; }
.compare-table .section-header td { background: #f5f3ff; font-weight: 700; font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.05em; color: #7c3aed; }
.compare-table .yes { color: #059669; font-weight: 600; }
.compare-table .no  { color: #ef4444; }
.compare-table .check { color: #059669; }
.compare-table .cross { color: #ef4444; }
