/* stock-filter.css — page-specific styles for /ftf/app/stock-filter/ */
/* Re-uses the dark fintech tokens established by dashboard.css. */

html {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

body.ftf-body {
  background: var(--bg-app);
  color: var(--text-alpha-85);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 13px;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  height: auto;
  overflow-x: hidden;
  overflow-y: auto;
}

/* ==== Header ==== */
.ftf-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-app);
}
.ftf-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.ftf-brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--border-subtle) 0%, var(--border-strong) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--text-alpha-85);
}
.ftf-brand-line1 { font-size: 11px; color: var(--text-alpha-55); }
.ftf-brand-line2 { font-size: 11px; color: var(--text-alpha-55); }
.ftf-page-title {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-alpha-85);
  margin-left: 12px;
}
.ftf-header-action {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  background: var(--surface-glass);
  color: var(--text-alpha-85);
  border: 1px solid var(--surface-tint-12);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 140ms ease;
}
.ftf-header-action:hover {
  background: var(--info-hover-bg);
  border-color: var(--info-hover-border);
  color: var(--text-heading);
}

/* ==== Freshness badge (Task 4) ==== */
.ftf-freshness-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 12px;
  padding: 4px 10px;
  background: var(--surface-glass-soft);
  border: 1px solid var(--surface-tint-08);
  border-radius: 4px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--text-alpha-55);
  white-space: nowrap;
}
.ftf-freshness-badge::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--info-strong);
}
.ftf-freshness-badge.is-stale::before { background: var(--warning); }
.ftf-freshness-badge.is-missing::before { background: var(--text-muted-strong); }
.ftf-freshness-badge.is-missing { color: var(--text-alpha-35); }
#ftf-freshness-date { color: var(--text-alpha-78); }

/* ==== Shell ==== */
.ftf-sf-shell {
  width: 100%;
  max-width: none;
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  padding: 14px 16px;
}

/* ==== Filter bar ==== */
.ftf-sf-filters {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 14px;
}
.ftf-sf-filter-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.ftf-sf-filter-row:last-child { margin-bottom: 0; }
.ftf-sf-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ftf-sf-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-alpha-45);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.ftf-sf-field input,
.ftf-sf-field select {
  background: var(--bg-input);
  color: var(--text-alpha-90);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  padding: 7px 10px;
  font-family: inherit;
  font-size: 12px;
  outline: none;
  transition: border-color 140ms;
}
.ftf-sf-field input:focus,
.ftf-sf-field select:focus {
  border-color: var(--info-action-border);
}
.ftf-sf-field input::placeholder { color: var(--text-alpha-25); }
.ftf-sf-checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin: 0 0 0 8px;
  padding: 7px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  color: var(--text-alpha-70);
  cursor: pointer;
  user-select: none;
  font-size: 12px;
}
.ftf-sf-checkbox:hover {
  border-color: var(--info-hover-border);
  color: var(--text-alpha-95);
}
.ftf-sf-checkbox input { margin: 0; }
.ftf-sf-filter-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}
.ftf-sf-btn {
  background: var(--bg-input);
  color: var(--text-alpha-85);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  padding: 7px 14px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 120ms ease;
}
.ftf-sf-btn:hover {
  background: var(--info-hover-bg);
  border-color: var(--info-hover-border);
}
.ftf-sf-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.ftf-sf-btn-primary {
  background: var(--info-action-bg);
  border-color: var(--info-hover-border);
  color: var(--text-on-accent);
}
.ftf-sf-btn-primary:hover {
  background: var(--info-action-bg-hover);
}
.ftf-sf-meta {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-alpha-55);
  font-family: ui-monospace, Menlo, monospace;
}

/* ==== Inline chart panel ==== */
.ftf-sf-chart-panel {
  position: relative;  /* containing block for absolutely-positioned #ticker-chart from chart-subsystem */
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  margin-bottom: 14px;
  overflow: hidden;
  transition: max-height 220ms ease;
  max-height: 700px;
}
.ftf-sf-chart-panel.ftf-sf-chart-collapsed {
  max-height: 60px;
}
.ftf-sf-chart-panel.ftf-sf-chart-collapsed .ftf-sf-chart-host {
  display: none;
}
.ftf-sf-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
  z-index: 10;
}
.ftf-sf-chart-collapsed .ftf-sf-chart-header {
  border-bottom: none;
}
.ftf-sf-chart-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-alpha-70);
}
.ftf-sf-chart-icon {
  color: var(--info-icon-soft);
  transition: transform 220ms ease;
}
.ftf-sf-chart-panel:not(.ftf-sf-chart-collapsed) .ftf-sf-chart-icon {
  transform: rotate(90deg);
}
.ftf-sf-chart-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}
.ftf-sf-chart-link {
  font-size: 11px;
  color: var(--info-soft-text);
  text-decoration: none;
  letter-spacing: 0.04em;
}
.ftf-sf-chart-link:hover { color: var(--text-heading); }
.ftf-sf-chart-close {
  background: transparent;
  color: var(--text-alpha-55);
  border: 1px solid transparent;
  border-radius: 4px;
  width: 24px;
  height: 24px;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ftf-sf-chart-close:hover {
  background: var(--surface-tint-06);
  color: var(--text-heading);
}
.ftf-sf-chart-host {
  height: auto;          /* follows embed iframe height (set in index.php) */
  position: relative;
}

/* ==== Results table ==== */
.ftf-sf-results {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  overflow: hidden;
}
.ftf-sf-table-wrap {
  max-height: calc(100vh - 410px);
  min-height: 220px;
  overflow-y: auto;
  overflow-x: auto;
}
.ftf-sf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.ftf-sf-table th {
  background: var(--bg-input);
  color: var(--text-alpha-55);
  text-align: left;
  padding: 10px 14px;
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.ftf-sf-table th[data-sort] {
  cursor: pointer;
  user-select: none;
}
.ftf-sf-table th[data-sort]:hover {
  color: var(--text-alpha-85);
}
.ftf-sf-table th.ftf-sf-num {
  text-align: right;
}
.ftf-sf-table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 100ms;
  border-left: 3px solid transparent;
}
.ftf-sf-table tbody tr:hover {
  background: var(--surface-tint-02);
}
.ftf-sf-table tbody tr.ftf-sf-active {
  background: rgba(125, 211, 252, 0.05);
  border-left-color: var(--info-strong);
}
.ftf-sf-table td {
  padding: 9px 14px;
  color: var(--text-alpha-85);
  white-space: nowrap;
}
.ftf-sf-table td.ftf-sf-num {
  text-align: right;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
}
.ftf-sf-ticker {
  font-weight: 600;
  color: var(--text-strong);
  letter-spacing: 0.02em;
}
.ftf-sf-company {
  color: var(--text-alpha-70);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ftf-sf-muted { color: var(--text-alpha-35); }
.ftf-sf-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
}
.ftf-sf-pill-data {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
}
.ftf-sf-pill-no-data {
  background: var(--surface-tint-05);
  color: var(--text-alpha-35);
}
.ftf-sf-loading,
.ftf-sf-empty,
.ftf-sf-error {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-alpha-55);
  font-size: 12px;
}
.ftf-sf-error { color: var(--danger-text); }

/* ==== Pagination ==== */
.ftf-sf-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 14px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-panel);
}
.ftf-sf-page-info {
  font-size: 12px;
  font-family: ui-monospace, Menlo, monospace;
  color: var(--text-alpha-55);
  min-width: 120px;
  text-align: center;
}


/* === Appended from index.php === */


    /* Shell layout: header on top, sidebar + main below */
    body.ftf-body { display: flex; flex-direction: column; min-height: 100vh; margin: 0; }
    .ftf-shell { display: flex; flex: 1; min-height: 0; }
    .ftf-shell > main { flex: 1; min-width: 0; }
  

/* === Block 2 === */


/* Watchlist V1 — Stock Filter row stars */
.ftf-sf-row td:first-child { position: relative; }
.ftf-sf-row-star { display:inline-flex; align-items:center; justify-content:center; width:22px; height:22px; padding:0; margin-right:4px; background:transparent; border:none; cursor:pointer; color:var(--text-disabled); transition:color 0.15s, transform 0.15s; vertical-align:middle; }
.ftf-sf-row-star:hover { color:var(--text-heading); transform:scale(1.1); }
.ftf-sf-row-star[data-saved="1"] { color:#22d3ee; }
.ftf-sf-row-star[data-saved="1"] svg path { fill:#22d3ee; }
.ftf-sf-row-star[data-saved="0"] svg path { fill:transparent; }
.ftf-sf-row-star:focus { outline:none; }
.ftf-sf-row-star:focus-visible { outline:2px solid var(--accent); outline-offset:2px; border-radius:4px; }

/* Filter panel collapse */
.ftf-sf-filters { position: relative; transition: padding 0.2s; }
.ftf-sf-filters-toggle { position: absolute; top: 4px; left: 4px; width: 12px; height: 12px; display: inline-flex; align-items: center; justify-content: center; padding: 0; background: transparent; border: 1px solid transparent; border-radius: 4px; cursor: pointer; color: var(--text-muted); line-height: 1; transition: color 0.15s, background 0.15s; z-index: 5; }
.ftf-sf-filters-toggle:hover { color: var(--text-heading); background: var(--surface-tint-05); border-color: var(--border-strong); }
.ftf-sf-filters-toggle svg { transition: transform 0.2s; }
.ftf-sf-filters-collapsed .ftf-sf-filters-toggle svg { transform: rotate(-90deg); }
.ftf-sf-filters-collapsed > *:not(.ftf-sf-filters-toggle):not(.ftf-sf-filters-collapsed-label) { display: none !important; }
.ftf-sf-filters-collapsed { padding: 6px 8px 6px 24px !important; min-height: 0; }
.ftf-sf-filters-collapsed-label { display: none; color: var(--text-muted-strong); font-size: 11px; letter-spacing: 0.5px; }
.ftf-sf-filters-collapsed .ftf-sf-filters-collapsed-label { display: inline; }
    .ftf-brand-logo-img { height: 27px; width: auto; display: block; }

@media (max-width: 820px) {
  .ftf-sidebar { display: none; }
  .ftf-sf-shell { padding: 14px 12px; }
}
