/* Positions page — rich cards (visual refresh) */

/* KPI strip */
.pos-kpi-strip {
  display: flex;
  flex-wrap: nowrap;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 8px;
  margin-bottom: var(--gap);
  gap: 0;
  overflow-x: auto;
  box-shadow: var(--shadow-sm), var(--shadow-inset);
  position: relative;
}
.pos-kpi-strip::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 80% at 50% 0%, rgba(88,166,255,0.06), transparent 60%);
  border-radius: var(--radius-lg);
  pointer-events: none;
}
.pos-kpi {
  flex: 1 1 0;
  padding: 0 24px;
  border-right: 1px solid var(--border);
  min-width: 160px;
  position: relative;
}
.pos-kpi:last-child { border-right: none; }
.kp-l { font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 6px; font-weight: 700; }
.kp-v {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.1;
  margin-bottom: 4px;
}
.kp-s { font-size: 11px; }

/* Tabs */
.pos-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: var(--gap);
  background: var(--bg-2);
  padding: 4px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  width: fit-content;
}
.pos-tab {
  background: transparent;
  color: var(--text-2);
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all var(--t-fast);
}
.pos-tab:hover { color: var(--text-1); background: var(--bg-3); }
.pos-tab.active {
  background: var(--grad-accent);
  color: white;
  box-shadow: var(--glow-blue);
}

/* Grid */
.pos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: var(--gap);
}

/* Card (refreshed) */
.pos-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  overflow: hidden;
  transition: transform var(--t-base), box-shadow var(--t-base), border-color var(--t-base);
  box-shadow: var(--shadow-sm), var(--shadow-inset);
}
.pos-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md), var(--shadow-inset);
}
.pos-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--green), transparent);
  opacity: 0.7;
}
.pos-card[data-side="short"]::before {
  background: linear-gradient(90deg, transparent, var(--red), transparent);
}
.pos-card::after {
  content: '';
  position: absolute;
  top: -50%; right: -30%;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(88,166,255,0.06), transparent 70%);
  pointer-events: none;
}

/* Card head */
.pos-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.pc-symbol {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pc-symbol strong {
  font-size: 17px;
  letter-spacing: -0.3px;
}
.badge-exch, .badge-side {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.badge-exch {
  background: var(--bg-3);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.badge-side.pos {
  background: linear-gradient(135deg, rgba(63,185,80,0.20), rgba(63,185,80,0.10));
  color: #4ade80;
  border: 1px solid rgba(63,185,80,0.4);
}
.badge-side.neg {
  background: linear-gradient(135deg, rgba(248,81,73,0.20), rgba(248,81,73,0.10));
  color: #f87171;
  border: 1px solid rgba(248,81,73,0.4);
}

.pc-pnl { text-align: right; }
.pc-net {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.1;
}
.pc-gross { font-size: 11px; margin-top: 4px; }

/* Body: safety donut + meta */
.pos-card-body {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  border-top: 1px solid var(--border);
}
.pc-safety {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.donut.pos {
  color: var(--green);
  filter: drop-shadow(0 0 8px rgba(63,185,80,0.4));
}
.donut.neg {
  color: var(--red);
  filter: drop-shadow(0 0 8px rgba(248,81,73,0.4));
}
.donut.muted { color: var(--text-3); }
.pc-meta { flex: 1; }
.pc-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}
.pc-meta-row:last-child { margin-bottom: 0; }
.pc-meta-row strong { color: var(--text-1); font-weight: 700; }

/* Data table */
.pc-table {
  width: 100%;
  font-size: 12px;
}
.pc-table td { padding: 4px 0; }
.pc-table td.right { text-align: right; }
.pc-table tr:hover td { background: rgba(88,166,255,0.03); }

/* DDCA + Price scale sections */
.pc-section {
  background: rgba(0,0,0,0.25);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,0.03);
}
.pc-section-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  align-items: center;
}
.ddca-bar {
  display: flex;
  gap: 3px;
}
.ddca-seg {
  flex: 1;
  height: 10px;
  background: var(--bg-3);
  border-radius: 3px;
  position: relative;
  overflow: hidden;
}
.ddca-seg.filled {
  background: linear-gradient(180deg, #58a6ff, #1f6feb);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2);
}
.ddca-seg.ai-zone {
  background: rgba(188,140,255,0.15);
  border: 1px dashed rgba(188,140,255,0.3);
}
.ddca-seg.ai-zone.filled {
  background: linear-gradient(180deg, #bc8cff, #8957e5);
  border: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 0 8px rgba(188,140,255,0.5);
}

/* Price scale */
.price-scale {
  position: relative;
  height: 32px;
  background: var(--bg-3);
  border-radius: var(--radius-sm);
  margin: 14px 0 8px;
  overflow: visible;
}
.ps-zone-loss {
  position: absolute;
  top: 0; bottom: 0;
  left: 0;
  background: linear-gradient(90deg, rgba(248,81,73,0.35), rgba(248,81,73,0.15));
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.ps-zone-win {
  position: absolute;
  top: 0; bottom: 0;
  background: linear-gradient(90deg, rgba(63,185,80,0.15), rgba(63,185,80,0.35));
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.ps-marker {
  position: absolute;
  top: -4px; bottom: -4px;
  width: 2px;
  background: var(--text-2);
  transform: translateX(-50%);
}
.ps-marker.m-avg {
  background: var(--text-1);
  width: 3px;
  box-shadow: 0 0 6px rgba(255,255,255,0.3);
}
.ps-marker.m-tp { background: var(--blue); box-shadow: 0 0 4px rgba(88,166,255,0.6); }
.ps-marker-label {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--text-2);
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.3px;
}
.ps-current {
  position: absolute;
  top: 50%;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: white;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 3px var(--bg-1), 0 0 12px rgba(255,255,255,0.4);
  z-index: 2;
}
.ps-current.pos {
  background: var(--green);
  box-shadow: 0 0 0 3px var(--bg-1), 0 0 16px rgba(63,185,80,0.7);
  animation: live-pulse 2s infinite;
}
.ps-current.neg {
  background: var(--red);
  box-shadow: 0 0 0 3px var(--bg-1), 0 0 16px rgba(248,81,73,0.7);
}
.ps-scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-3);
  font-family: var(--font-mono);
  margin-top: 6px;
}

/* TP rows */
.pc-tps {
  display: flex;
  flex-direction: column;
  gap: 0;
  font-size: 12px;
}
.pc-tp-row {
  display: grid;
  grid-template-columns: 80px 1fr 80px;
  gap: 8px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
  transition: background var(--t-fast);
}
.pc-tp-row:hover { background: rgba(88,166,255,0.04); }
.pc-tp-row:last-child { border-bottom: none; }
.pc-tp-row.tp-filled {
  color: var(--text-3);
  text-decoration: line-through;
  background: rgba(63,185,80,0.05);
}
.pc-tp-row > :nth-child(2) { text-align: right; }
.pc-tp-row > :nth-child(3) { text-align: right; }

/* P&L summary */
.pc-pnl-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(0,0,0,0.30), rgba(0,0,0,0.20));
  border-radius: var(--radius-sm);
  font-size: 13px;
  border: 1px solid rgba(255,255,255,0.03);
}
.pc-pnl-summary > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.pc-pnl-summary strong {
  font-size: 15px;
  letter-spacing: -0.3px;
}

/* Actions */
.pc-actions {
  display: flex;
  gap: 8px;
}
.pc-actions a { flex: 1; text-align: center; justify-content: center; }

/* Forecast badges */
.badge-fc {
  display: inline-block;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.fc-win-fast  { background: linear-gradient(135deg, rgba(63,185,80,0.25), rgba(63,185,80,0.15)); color: #4ade80; border: 1px solid rgba(63,185,80,0.4); }
.fc-win-slow  { background: linear-gradient(135deg, rgba(88,166,255,0.25), rgba(88,166,255,0.15)); color: var(--blue); border: 1px solid rgba(88,166,255,0.4); }
.fc-neutral   { background: rgba(201,209,217,0.15); color: var(--text-2); border: 1px solid var(--border); }
.fc-risk      { background: linear-gradient(135deg, rgba(248,81,73,0.25), rgba(248,81,73,0.15)); color: #f87171; border: 1px solid rgba(248,81,73,0.4); }

@media (max-width: 700px) {
  .pos-kpi-strip { flex-wrap: wrap; }
  .pos-kpi { flex: 1 1 45%; border-right: none; border-bottom: 1px solid var(--border); padding: 12px 16px; }
  .pos-grid { grid-template-columns: 1fr; }
}
