/* ── IPO Tracker Styles ──
   Brand palette: Deep navy (#0f172a) + Vibrant Purple (#7c3aed) + Emerald (#059669)
   Mirrors brokers/style.css with IPO-specific additions
   ──────────────────────────────────────────────────────────────────── */

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,
[data-sidebar] h3 {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7c3aed;
  margin: 1.25rem 0 0.5rem;
}
[data-sidebar] h3:first-child { margin-top: 0; }
.sidebar-close { display: none; }
[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.active {
  background: #f5f3ff;
  color: #7c3aed;
  font-weight: 600;
}

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

/* ── Results bar ── */
.results-bar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.25rem; font-size: 0.8125rem; color: #6b7280;
}

/* ── View toggle (cards / list) ── */
.view-toggle { display: flex; gap: 0.375rem; }
.view-toggle button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  flex-shrink: 0;
  border: 1px solid #e5e0f0;
  border-radius: 8px;
  background: #fff;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.12s;
}
.view-toggle button:hover { border-color: #c4b5fd; color: #7c3aed; }
.view-toggle button.active { background: #7c3aed; color: #fff; border-color: #7c3aed; }
.view-toggle button svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ── IPO list view (table) ── */
.ipo-list { display: block; }
.ipo-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 0.625rem;
  font-size: 0.8125rem;
}
.ipo-table th {
  text-align: left;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
  padding: 0 1rem 0.25rem;
  font-weight: 600;
}
.ipo-table td {
  background: #fff;
  border-top: 1px solid #e5e0f0;
  border-bottom: 1px solid #e5e0f0;
  padding: 0.875rem 1rem;
  vertical-align: middle;
  transition: border-color 0.15s, background 0.15s;
}
.ipo-table tbody tr td:first-child { border-left: 1px solid #e5e0f0; border-radius: 12px 0 0 12px; }
.ipo-table tbody tr td:last-child { border-right: 1px solid #e5e0f0; border-radius: 0 12px 12px 0; }
.ipo-table tbody tr { cursor: pointer; }
.ipo-table tbody tr:hover td {
  border-color: #c4b5fd;
  background: #fcfbff;
}
.ipo-table .list-name {
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
}
.ipo-table .list-sub { font-size: 0.75rem; color: #9ca3af; margin-top: 2px; }
.ipo-table .cell-value { color: #374151; white-space: nowrap; }
.ipo-table .cell-gmp { white-space: nowrap; }
.ipo-table .type-tag { white-space: nowrap; }
@media (max-width: 768px) {
  .ipo-table th:nth-child(3), .ipo-table td:nth-child(3) { display: none; }
  .ipo-table th:nth-child(5), .ipo-table td:nth-child(5) { display: none; }
  .ipo-table th:nth-child(6), .ipo-table td:nth-child(6) { display: none; }
}
@media (max-width: 480px) {
  .ipo-table th:nth-child(4), .ipo-table td:nth-child(4) { display: none; }
  .ipo-table .list-sub { display: none; }
}

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

.ipo-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;
  color: inherit;
  height: 100%;
}
.ipo-card:hover {
  border-color: #c4b5fd;
  box-shadow: 0 8px 28px rgba(124, 58, 237, 0.08);
  transform: translateY(-2px);
}
.ipo-card .ipo-name {
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.3;
  color: #0f172a;
  margin-bottom: 0.75rem;
}
.ipo-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.625rem;
}

.ipo-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;
}
.ipo-card .meta-row:last-of-type { border-bottom: none; }
.ipo-card .meta-row svg {
  width: 15px; height: 15px; flex-shrink: 0;
  color: #9ca3af;
}
.ipo-card .meta-row .meta-value { font-weight: 500; color: #374151; }

.ipo-card .sub-toggle {
  margin-left: auto;
  border: 1px solid #c4b5fd;
  background: #faf8ff;
  color: var(--primary, #7c3aed);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.12s;
}
.ipo-card .sub-toggle:hover { background: #f3f0ff; }
.ipo-card .sub-detail { display: none; padding: 0.25rem 0 0.625rem; }
.ipo-card .sub-detail.open { display: block; }

.sub-daywise {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}
.sub-daywise th, .sub-daywise td {
  padding: 4px 6px;
  text-align: right;
  border-bottom: 1px solid #f3f0ff;
  white-space: nowrap;
}
.sub-daywise th:first-child, .sub-daywise td:first-child { text-align: left; color: #6b7280; font-weight: 500; }
.sub-daywise thead th { color: #9ca3af; font-weight: 500; font-size: 0.6875rem; }
.sub-daywise th.latest, .sub-daywise td.latest { background: #faf8ff; color: #7c3aed; font-weight: 700; }
.sub-daywise-wrap { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px dashed #e5e7eb; }
.sub-daywise-wrap .daywise-title { font-size: 11px; color: #9ca3af; font-weight: 500; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.04em; }

.ipo-card .card-actions {
  padding: 0.75rem 0;
  margin-top: auto;
}
.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: 600;
  letter-spacing: 0.03em;
  background: #fff;
  color: var(--primary, #7c3aed);
  border: 1px solid #c4b5fd;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s;
  min-height: 42px;
}
.view-btn:hover { background: #f5f3ff; }
.view-btn svg { width: 14px; height: 14px; }

/* ── Status 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;
  text-transform: uppercase;
}
.type-tag.open     { background: #f0fdf4; color: #059669; }
.type-tag.upcoming { background: #f5f3ff; color: #7c3aed; }
.type-tag.closed   { background: #fffbeb; color: #d97706; }
.type-tag.listed   { background: #f3f4f6; color: #374151; }

/* ── GMP badge ── */
.gmp-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.625rem;
  border-radius: 6px;
  font-size: 0.6875rem;
  font-weight: 700;
  background: #fdf2f8;
  color: #db2777;
  white-space: nowrap;
}
.gmp-badge.listed { background: #f3f4f6; color: #374151; }

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

@media (max-width: 768px) {
  .hero-search { padding: 1.5rem 1rem; }
  .hero-search h1 { font-size: 1.375rem; }
  .ipo-grid { gap: 0.875rem; }
  .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] .sidebar-close {
    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] .sidebar-close:hover { color: #374151; border-color: #c4b5fd; }
}
@media (max-width: 480px) {
  .hero-search h1 { font-size: 1.25rem; }
  .hero-search p { font-size: 0.8125rem; }
}

/* ════════════════════════════════════════════
   SHARED PATTERNS (detail pages)
   ════════════════════════════════════════════ */

.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-value.red { color: #ef4444; }
.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; }

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

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

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

/* ── Financials table (detail) ── */
.fin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.fin-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: #6b7280; padding: 8px 0; border-bottom: 1px solid #e5e0f0; }
.fin-table th:not(:first-child), .fin-table td:not(:first-child) { text-align: right; }
.fin-table td { padding: 10px 0; border-bottom: 1px solid #f3f0ff; font-variant-numeric: tabular-nums; }
.fin-table tr:last-child td { border-bottom: none; }
.fin-table .positive { color: #059669; font-weight: 600; }
.fin-table .negative { color: #ef4444; font-weight: 600; }

/* ── Subscription progress bar (detail) ── */
.sub-bar { margin-bottom: 10px; }
.sub-bar:last-of-type { margin-bottom: 0; }
.sub-bar .sub-label { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; }
.sub-bar .sub-label .sb-name { color: #6b7280; }
.sub-bar .sub-label .sb-val { font-weight: 700; }
.sub-track { height: 8px; background: #f3f0ff; border-radius: 999px; overflow: hidden; }
.sub-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #7c3aed, #a78bfa); }

/* ── GMP chart (detail) ── */
.gmp-chart { margin-top: 12px; }
.gmp-chart svg { width: 100%; height: 90px; display: block; }
