/* ===== Index Alpha Lens — page styles (clean, no JS-drawer / no sticky-sync deps) ===== */

:root {
  --ial-blue: #1d4ed8;
  --ial-blue-soft: rgba(29, 78, 216, 0.08);
  --ial-border: #e2e8f0;
  --ial-text: #334155;
  --ial-muted: #64748b;
}

html,
body {
  overflow-x: clip;
}

.ial-page {
  background: #f8fafc;
  color: #1e293b;
  font-family: 'Inter', system-ui, sans-serif;
  min-height: 100vh;
  padding: 32px 0 64px;
  overflow-x: clip;
}

.ial-container {
  width: 100%;
  margin: 0 auto;
  padding: 0 16px;
  min-width: 0;
  box-sizing: border-box;
}

.ial-heading h1 {
  font-size: 26px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 4px;
}

.ial-heading p {
  color: var(--ial-muted);
  margin: 0 0 24px;
}

.ial-layout {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 14px;
  position: relative;
  min-width: 0;
  align-items: stretch;
}

@media (max-width: 1024px) {
  .ial-layout {
    grid-template-columns: 1fr;
  }

  .ial-filters {
    min-height: 320px;
    max-height: 400px;
  }
}

.ial-filters {
  background: #fff;
  border: 1px solid var(--ial-border);
  border-radius: 16px;
  padding: 14px 14px;
  min-width: 0;
  min-height: 480px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ial-filters__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex: 0 0 auto;
  gap: 8px;
}

.ial-filters__head h2 {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: #0f172a;
}

.ial-icon {
  color: #94a3b8;
}

.ial-reset {
  background: none;
  border: none;
  color: #ef4444;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 6px;
  transition: background .15s ease;
}

.ial-reset:hover {
  background: #fef2f2;
}

.ial-filters__body {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 70px;
}

.ial-filters__body::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.ial-section {
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
}

.ial-section--last {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 70px;
}

.ial-section h3 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ial-muted);
  margin: 0 0 8px;
}

.ial-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  margin: 0 0 8px;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.ial-section__head h3 {
  margin: 0;
}

.ial-caret {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  margin-left: 8px;
  border-right: 2px solid #94a3b8;
  border-bottom: 2px solid #94a3b8;
  transform: rotate(-135deg);
}

.ial-section__head:hover .ial-caret {
  border-color: #64748b;
}

.ial-section__body {
  display: block;
}

.ial-section.is-collapsed .ial-caret {
  transform: rotate(45deg);
}

.ial-section.is-collapsed .ial-section__body {
  display: none;
}

.ial-section label,
.ial-field-label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #94a3b8;
  margin: 0 0 6px;
}

.ial-range-inputs input,
.ial-range-inputs--plain input {
  width: 100%;
  border: 1.5px solid var(--ial-border);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--ial-text);
  background: #fff;
  box-sizing: border-box;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.ial-range-inputs input:focus {
  outline: none;
  border-color: var(--ial-blue);
  box-shadow: 0 0 0 3px var(--ial-blue-soft);
  background-color: #fff;
}

.ial-range-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.ial-range-inputs--plain {
  margin-bottom: 10px;
}

.ial-range-inputs span {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  flex-shrink: 0;
}

.ial-range-inputs input::placeholder {
  color: #cbd5e1;
}

.ial-select-css {
  position: relative;
}

.ial-select-css summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1.5px solid var(--ial-border);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--ial-text);
  background: #fff;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.ial-select-css summary::-webkit-details-marker {
  display: none;
}

.ial-select-css summary::marker {
  content: "";
}

.ial-select-css summary:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.ial-select-css__arrow {
  width: 9px;
  height: 9px;
  flex-shrink: 0;
  border-right: 1.6px solid #94a3b8;
  border-bottom: 1.6px solid #94a3b8;
  transform: rotate(45deg) translateY(-2px);
  transition: transform .15s ease;
}

.ial-select-css[open] summary {
  border-color: var(--ial-blue);
  box-shadow: 0 0 0 3px var(--ial-blue-soft);
  background: #fff;
}

.ial-select-css[open] .ial-select-css__arrow {
  transform: rotate(-135deg) translateY(1px);
}

.ial-select-css__panel {
  position: fixed;
  background: #fff;
  border: 1px solid var(--ial-border);
  border-radius: 12px;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.14);
  padding: 6px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 1000;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.ial-select-css__panel::-webkit-scrollbar {
  display: none;
}

.ial-select-css__option {
  display: block;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ial-text);
  cursor: pointer;
  transition: background .1s ease;
  margin: 0;
  text-transform: none;
  letter-spacing: normal;
}

.ial-select-css__option:hover {
  background: #f1f5f9;
}

.ial-select-css__option input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.ial-select-css__option:has(input:checked) {
  background: var(--ial-blue-soft);
  color: var(--ial-blue);
  font-weight: 700;
}

/* ===== Results Container ===== */
.ial-results {
  background: #fff;
  border: 1px solid var(--ial-border);
  border-radius: 14px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 4px 6px 8px;
}

#ialResultsWrapper {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.ial-row-name {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  color: #142b45;
  line-height: 1.25;
  font-size: 14px;
}

.ial-table td:first-child,
.ial-index-link {
  white-space: normal !important;
  max-width: 240px;
}

.ial-logo {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: #eff6ff;
  color: var(--ial-blue);
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ial-logo-img {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.ial-index-link {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
  display: inline;
  vertical-align: middle;
  transition: color .15s ease, font-weight .15s ease;
}

.ial-index-link:hover {
  color: #000;
  font-weight: 700;
}

/* DataTable Sorter layout: ensures indicator stays pinned to the right edge */
.datatable-sorter {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  position: relative !important;
  padding-right: 18px !important;
  width: 100% !important;
  box-sizing: border-box !important;
  text-decoration: none !important;
  color: inherit !important;
}

.ial-table th:first-child .datatable-sorter {
  min-width: 180px;
}

/* Status Badges */
.ial-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 84px;
  height: 25px;
  font-size: 12px;
  font-weight: 600;
  padding: 0 6px;
  border-radius: 5px;
  white-space: nowrap;
}

.ial-badge--sectoral {
  background: #f1f5f9;
  color: #475569;
}

.ial-badge--broad-market {
  background: #fef3c7;
  color: #b45309;
}

.ial-badge--strategic {
  background: #cffafe;
  color: #0e7490;
}

.ial-badge--strategy {
  background: #cffafe;
  color: #0e7490;
}

.ial-badge--thematic {
  background: #fae8ff;
  color: #a21caf;
}

.ial-badge--overvalued {
  background: #fee2e2;
  color: #b91c1c;
}

.ial-badge--undervalued {
  background: #d1fae5;
  color: #047857;
}

.ial-badge--neutral {
  background: #e0e7ff;
  color: #4338ca;
}

.ial-footbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid #f1f5f9;
  font-size: 13px;
  color: var(--ial-muted);
}

.ial-empty-row td {
  text-align: center;
  padding: 24px;
  color: #94a3b8;
}

/* Status & Value colors/animations */
.ial-value-up {
  color: #16a34a;
  font-weight: 700;
}

.ial-value-down {
  color: #dc2626;
  font-weight: 700;
}

.ial-table-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 2px;
  padding: 0 4px;
}

/* ===== Mobile  ===== */
@media (max-width: 640px) {
  .ial-page {
    padding: 20px 0 64px;
  }

  .ial-container {
    padding: 0 14px;
  }

  .ial-heading h1 {
    font-size: 21px;
  }

  .ial-filters {
    position: static;
    min-height: 300px;
    max-height: 380px;
  }

  .ial-badge {
    min-width: 88px;
    font-size: 11px;
  }
}

/* ================= DataTable Pagination Alignment ================= */
#ialResultsWrapper .datatable-wrapper .datatable-bottom,
.ial-page .datatable-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

#ialResultsWrapper .datatable-pagination,
.ial-page .datatable-pagination {
  margin-left: auto;
}