/* =============================================
   screening_stock — modal.css
   ============================================= */

.overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(8px);
  display: none; align-items: flex-start;
  justify-content: center;
  padding: 56px 16px 16px;
  overflow-y: auto;
}
.overlay.show { display: flex; }

.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%; max-width: 880px;
  animation: slideUp 0.28s ease;
  overflow: hidden;
  margin-bottom: 24px;
}

/* Header */
.modal-header {
  background: var(--surface);
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between;
  align-items: flex-start; gap: 16px;
}
.modal-sym {
  font-family: var(--font-mono); font-size: 12px;
  color: var(--accent); margin-bottom: 4px; letter-spacing: 0.5px;
}
.modal-name {
  font-family: var(--font-serif); font-size: 22px;
  color: var(--text); margin-bottom: 8px; line-height: 1.2;
}
.modal-price-row { display: flex; align-items: baseline; gap: 8px; }
.modal-price {
  font-family: var(--font-mono); font-size: 28px;
  font-weight: 500; color: var(--text);
}
.modal-chg { font-size: 14px; font-family: var(--font-mono); }
.modal-meta { font-size: 11px; color: var(--text3); margin-top: 6px; }

.modal-hactions { display: flex; gap: 8px; flex-shrink: 0; align-items: flex-start; }
.btn-watch-modal {
  background: transparent; border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 14px;
  color: var(--text2); font-size: 12px; cursor: pointer;
  transition: all 0.15s; font-family: var(--font-sans);
}
.btn-watch-modal:hover { border-color: var(--gold); color: var(--gold); }
.btn-watch-modal.watching { background: rgba(240,180,41,0.12); border-color: var(--gold); color: var(--gold); }
.modal-close {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 12px;
  color: var(--text2); cursor: pointer; font-size: 16px;
  line-height: 1; transition: all 0.15s;
}
.modal-close:hover { border-color: var(--red); color: var(--red); }

/* Tabs */
.modal-tabs {
  display: flex; border-bottom: 1px solid var(--border);
  background: var(--bg2); overflow-x: auto;
}
.mtab {
  padding: 12px 18px; font-size: 13px; font-weight: 500;
  color: var(--text3); cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all 0.15s;
}
.mtab:hover { color: var(--text2); }
.mtab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Body */
.modal-body { padding: 22px 24px; }

/* KPI grid */
.kpi-grid {
  display: grid; grid-template-columns: repeat(4,1fr);
  gap: 12px; margin-bottom: 22px;
}
.kpi-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 9px; padding: 14px;
  transition: border-color 0.2s;
}
.kpi-card:hover { border-color: var(--border2); }
.kpi-lbl { font-size: 10px; color: var(--text3); font-weight: 600; letter-spacing: 0.3px; margin-bottom: 6px; }
.kpi-val { font-family: var(--font-mono); font-size: 18px; font-weight: 500; color: var(--text); }
.kpi-sub { font-size: 10px; color: var(--text3); margin-top: 2px; }

/* Fund tables */
.fund-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 20px; margin-bottom: 20px;
}
.fund-section-title {
  font-family: var(--font-serif); font-size: 16px;
  color: var(--text); margin-bottom: 10px;
}
.fund-tbl { width: 100%; }
.fund-tbl tr { border-bottom: 1px solid rgba(36,47,74,0.5); }
.fund-tbl tr:last-child { border-bottom: none; }
.fund-tbl td { padding: 7px 0; font-size: 12px; }
.fund-tbl td:first-child { color: var(--text3); }
.fund-tbl td:last-child {
  text-align: right;
  font-family: var(--font-mono); color: var(--text); font-weight: 500;
}

/* Bar chart */
.chart-section { margin-bottom: 22px; }
.chart-title { font-family: var(--font-serif); font-size: 16px; color: var(--text); margin-bottom: 10px; }
.bar-chart {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; height: 160px;
  display: flex; align-items: flex-end; padding: 12px 8px 8px;
  gap: 6px; position: relative; overflow: hidden;
}
.bc-bar {
  flex: 1; border-radius: 3px 3px 0 0; min-width: 10px;
  background: linear-gradient(180deg, var(--accent2), rgba(0,212,170,0.6));
  opacity: 0.8; transition: opacity 0.15s;
  position: relative;
}
.bc-bar:hover { opacity: 1; }
.bc-bar.neg { background: linear-gradient(180deg, var(--red), rgba(255,61,90,0.5)); }
.bc-label { position: absolute; left: 12px; top: 10px; font-size: 10px; color: var(--text3); }

/* Financials table */
.fin-tbl { width: 100%; }
.fin-tbl tr { border-bottom: 1px solid rgba(36,47,74,0.5); }
.fin-tbl tr:last-child { border-bottom: none; }
.fin-tbl th { padding: 8px 6px; font-size: 10px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: 0.4px; text-align: right; }
.fin-tbl th:first-child { text-align: left; }
.fin-tbl td { padding: 8px 6px; font-size: 12px; font-family: var(--font-mono); color: var(--text); text-align: right; }
.fin-tbl td:first-child { color: var(--text2); text-align: left; font-family: var(--font-sans); }

/* Technical */
.tech-grid {
  display: grid; grid-template-columns: repeat(3,1fr);
  gap: 12px; margin-bottom: 20px;
}
.tech-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 9px; padding: 14px;
}
.tech-lbl { font-size: 10px; color: var(--text3); font-weight: 600; margin-bottom: 6px; }
.tech-val { font-family: var(--font-mono); font-size: 16px; color: var(--text); }

/* Progress bar (52W position) */
.range-bar {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 9px; padding: 16px;
  margin-bottom: 14px;
}
.range-label { font-size: 11px; color: var(--text3); margin-bottom: 8px; }
.range-track {
  background: var(--border); border-radius: 4px; height: 6px;
  position: relative; margin: 8px 0;
}
.range-fill {
  position: absolute; left: 0; top: 0; height: 100%;
  background: var(--accent); border-radius: 4px;
  transition: width 0.5s ease;
}
.range-dot {
  position: absolute; top: 50%; transform: translate(-50%,-50%);
  width: 12px; height: 12px; background: var(--accent);
  border: 2px solid var(--bg2); border-radius: 50%;
}
.range-ends { display: flex; justify-content: space-between; font-size: 10px; color: var(--text3); font-family: var(--font-mono); }

/* Loading inside modal */
.modal-loading {
  display: flex; align-items: center; justify-content: center;
  padding: 40px; flex-direction: column; gap: 12px;
}

/* Responsive */
@media (max-width: 700px) {
  .kpi-grid { grid-template-columns: repeat(2,1fr); }
  .fund-grid { grid-template-columns: 1fr; }
  .tech-grid { grid-template-columns: repeat(2,1fr); }
  .modal-header { flex-direction: column; }
}
