/* ── Stock Broker Explorer Styles ──
   Brand palette: Deep navy (#0f172a) + Vibrant Purple (#7c3aed) + Emerald (#059669)
   Requires common.css to be loaded BEFORE this file.
   ──────────────────────────────────────────────────────────────────── */

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

/* ── Sidebar (base rules come from common.css) ── */
[data-sidebar] {
  width: 220px;
  background: #fff;
  border-right: 1px solid #e5e0f0;
  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 { 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;
}

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

/* ── Pill filter chips (.filter-chip base is in common.css) ── */
.filter-chips {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}
.filter-chip svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ── Results bar (base is in common.css) ── */
.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 + base card styles are in common.css) ── */
.broker-card {
  text-decoration: none;
  position: relative;
  overflow: hidden;
}
.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 { align-items: flex-start; }

.broker-card .broker-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Metadata rows ── */
.broker-card .meta-row .meta-muted { color: #9ca3af; }

/* ── Card actions ── */
.broker-card .card-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.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 {
  font-weight: 700;
  background: #7c3aed;
  color: #fff;
  border: none;
}
.view-btn:hover { background: #6d28d9; }

/* ── Type tags (base .type-tag is in common.css) ── */
.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) {
  .compare-bar { padding: 0.5rem 0.75rem; gap: 0.5rem; }

  /* ── 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; }
}

/* ════════════════════════════════════════════
   DETAIL / COMPARE PATTERNS
   (section-heading, icon-box, hero-card, pill, stats, info-row,
    pros-cons, btn-primary/outline etc. are in common.css)
   ════════════════════════════════════════════ */

.pill-light { background: #f5f3ff; color: #7c3aed; }

.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; }

.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-divider { height: 1px; background: #e5e0f0; margin: 10px 0; }

.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 table ── */
.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; }