/* ============================================================
   dash-trade-modal.css — CompanyWager Prediction Slip
   Compact layout — fits in one screen, no scrolling needed.
   Exclusive to dash-home.html (authenticated users).
   ============================================================ */

/* ── Overlay ─────────────────────────────────────────────── */
#cwDashSlipOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 20, 0.88);
  z-index: 9100;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: cdsOverlayIn 0.2s ease;
}
#cwDashSlipOverlay.active { display: flex; }

@keyframes cdsOverlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Slip panel — compact, sticky footer ────────────────── */
#cwDashSlip {
  width: 460px;
  max-width: 96vw;
  max-height: 96vh;
  /* Flex column so footer sticks to bottom */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  font-family: 'Inter', 'Space Grotesk', sans-serif;
  color: #e8f0fe;

  background:
    linear-gradient(180deg, rgba(0,212,255,0.03) 0%, transparent 35%),
    linear-gradient(160deg, #0c1322 0%, #0a1020 50%, #0d1628 100%);
  border: 1px solid rgba(255,255,255,0.07);
  border-top: 1px solid rgba(0,212,255,0.2);
  border-radius: 24px;
  box-shadow:
    0 0 0 1px rgba(0,212,255,0.05),
    0 32px 80px rgba(0,0,0,0.85),
    0 0 60px rgba(0,212,255,0.04),
    inset 0 1px 0 rgba(255,255,255,0.05);

  animation: cdsSlipIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  padding-bottom: 0;
}

@keyframes cdsSlipIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Close button ────────────────────────────────────────── */
#cwDashSlipClose {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: rgba(232,240,254,0.4);
  transition: all 0.2s;
  z-index: 10;
}
#cwDashSlipClose:hover {
  background: rgba(0,212,255,0.1);
  border-color: rgba(0,212,255,0.3);
  color: #00d4ff;
  transform: rotate(90deg);
}

/* ── Slip header ─────────────────────────────────────────── */
.cds-slip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 0;
}

.cds-slip-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 20px;
  border: 1px solid rgba(0,212,255,0.3);
  background: rgba(0,212,255,0.08);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #00d4ff;
  text-transform: uppercase;
  transition: all 0.2s;
}

.cds-badge-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #00d4ff;
  flex-shrink: 0;
  animation: cdsPulse 1.8s ease-in-out infinite;
}
@keyframes cdsPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.35; transform: scale(0.65); }
}

.cds-slip-id {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: rgba(232,240,254,0.2);
  font-variant-numeric: tabular-nums;
  padding-right: 38px;
}

/* ── Company row — compact ───────────────────────────────── */
.cds-company-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.cds-logo-wrap { position: relative; flex-shrink: 0; }

.cds-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  color: #00d4ff;
  position: relative;
  z-index: 1;
}
.cds-logo img { width: 100%; height: 100%; object-fit: contain; }

.cds-logo-ring {
  position: absolute;
  inset: -3px;
  border-radius: 15px;
  border: 1px solid rgba(0,212,255,0.3);
  pointer-events: none;
}

.cds-company-info { flex: 1; min-width: 0; }

.cds-company-name {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(232,240,254,0.4);
  margin-bottom: 2px;
}

.cds-question {
  font-size: 0.85rem;
  font-weight: 600;
  color: #e8f0fe;
  line-height: 1.35;
  /* Clamp to 2 lines max */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cds-deadline-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.65rem;
  color: rgba(232,240,254,0.3);
  margin-top: 3px;
}
.cds-deadline-row svg { opacity: 0.5; flex-shrink: 0; }

/* ── Section label ───────────────────────────────────────── */
.cds-section-label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(232,240,254,0.28);
  margin-bottom: 8px;
}

/* ── Prediction cards — compact ──────────────────────────── */
.cds-pred-section {
  padding: 10px 16px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.cds-pred-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.cds-pred-card {
  position: relative;
  border-radius: 14px;
  padding: 12px 10px 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  border: 2px solid transparent;
  overflow: hidden;
  user-select: none;
}

/* YES */
.cds-pred-card.yes {
  background: rgba(0,212,255,0.04);
  border-color: rgba(0,212,255,0.15);
}
.cds-pred-card.yes:hover {
  background: rgba(0,212,255,0.09);
  border-color: rgba(0,212,255,0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,212,255,0.12);
}
.cds-pred-card.yes.active {
  background: linear-gradient(145deg, rgba(0,212,255,0.16), rgba(0,180,220,0.08));
  border-color: #00d4ff;
  box-shadow: 0 0 0 1px rgba(0,212,255,0.25), 0 8px 24px rgba(0,212,255,0.18);
}

/* NO */
.cds-pred-card.no {
  background: rgba(255,100,100,0.04);
  border-color: rgba(255,100,100,0.15);
}
.cds-pred-card.no:hover {
  background: rgba(255,100,100,0.09);
  border-color: rgba(255,100,100,0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(255,100,100,0.1);
}
.cds-pred-card.no.active {
  background: linear-gradient(145deg, rgba(255,80,80,0.16), rgba(220,60,60,0.08));
  border-color: #ff6464;
  box-shadow: 0 0 0 1px rgba(255,100,100,0.25), 0 8px 24px rgba(255,100,100,0.15);
}

.cds-pred-card.active::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.04) 0%, transparent 55%);
  border-radius: 12px;
  pointer-events: none;
}

.cds-pred-selected-dot {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.cds-pred-card.yes .cds-pred-selected-dot { background: #00d4ff; }
.cds-pred-card.no  .cds-pred-selected-dot { background: #ff6464; }
.cds-pred-card.active .cds-pred-selected-dot { display: block; }

.cds-pred-outcome {
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.cds-pred-outcome.yes { color: #00d4ff; }
.cds-pred-outcome.no  { color: #ff6464; }

.cds-pred-pct {
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 1px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.cds-pred-pct.yes { color: #00d4ff; }
.cds-pred-pct.no  { color: #ff6464; }

.cds-pred-chance {
  font-size: 0.62rem;
  color: rgba(232,240,254,0.3);
  font-weight: 500;
  margin-bottom: 6px;
}

.cds-pred-mult {
  display: inline-block;
  background: rgba(255,255,255,0.06);
  border-radius: 6px;
  padding: 2px 9px;
  font-size: 0.75rem;
  font-weight: 700;
  color: rgba(232,240,254,0.5);
  margin-bottom: 5px;
  transition: all 0.2s;
}
.cds-pred-card.yes.active .cds-pred-mult { background: rgba(0,212,255,0.15); color: #00d4ff; }
.cds-pred-card.no.active  .cds-pred-mult { background: rgba(255,100,100,0.15); color: #ff6464; }

.cds-pred-label {
  font-size: 0.65rem;
  color: rgba(232,240,254,0.35);
  line-height: 1.2;
  padding: 0 2px;
}

/* ── Chart — slim ────────────────────────────────────────── */
.cds-chart-section {
  padding: 8px 16px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.cds-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.cds-chart-toggles { display: flex; gap: 3px; }

.cds-chart-toggle {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: rgba(232,240,254,0.35);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  text-transform: uppercase;
}
.cds-chart-toggle.active {
  background: rgba(0,212,255,0.1);
  border-color: rgba(0,212,255,0.3);
  color: #00d4ff;
}

/* Chart height reduced */
.cds-chart-wrap {
  height: 52px;
  position: relative;
}
.cds-chart-wrap canvas,
.cds-chart-wrap svg.cds-svg-chart {
  width: 100% !important;
  height: 100% !important;
}

/* ── Amount section — compact ────────────────────────────── */
.cds-amount-section {
  padding: 10px 16px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.cds-amount-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.04);
  border: 1.5px solid rgba(255,255,255,0.09);
  border-radius: 12px;
  padding: 0 14px;
  height: 52px;
  cursor: text;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.cds-amount-wrap:focus-within {
  border-color: rgba(0,212,255,0.45);
  box-shadow: 0 0 0 3px rgba(0,212,255,0.07);
}

.cds-amount-symbol {
  font-size: 1.1rem;
  font-weight: 700;
  color: rgba(232,240,254,0.25);
  flex-shrink: 0;
  line-height: 1;
  display: flex;
  align-items: center;
  align-self: center;
  margin-top: 1px;
}

.cds-amount-input {
  background: none;
  border: none;
  outline: none;
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 700;
  width: 100%;
  flex: 1;
  height: 100%;
  font-family: 'Inter', 'Space Grotesk', sans-serif;
  caret-color: #00d4ff;
  -moz-appearance: textfield;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  padding: 0;
  margin: 0;
  align-self: center;
}
.cds-amount-input::placeholder { color: rgba(232,240,254,0.12); }
.cds-amount-input:focus { outline: none; box-shadow: none; }
.cds-amount-input::-webkit-outer-spin-button,
.cds-amount-input::-webkit-inner-spin-button { -webkit-appearance: none; }

.cds-amount-token {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(232,240,254,0.25);
  flex-shrink: 0;
  background: rgba(255,255,255,0.05);
  border-radius: 5px;
  padding: 4px 8px;
  align-self: center;
  line-height: 1;
}

.cds-balance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 5px;
  font-size: 0.72rem;
  color: rgba(232,240,254,0.3);
  padding: 0 2px;
}
.cds-balance-row strong { color: rgba(232,240,254,0.65); font-weight: 600; }

.cds-max-btn {
  color: #00d4ff;
  font-weight: 700;
  font-size: 0.7rem;
  cursor: pointer;
  letter-spacing: 0.06em;
  transition: opacity 0.15s;
}
.cds-max-btn:hover { opacity: 0.65; }

/* Quick chips — compact row */
.cds-quick-chips {
  display: flex;
  gap: 5px;
  margin-top: 7px;
}

.cds-chip {
  flex: 1;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  padding: 6px 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(232,240,254,0.4);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  text-align: center;
}
.cds-chip:hover {
  background: rgba(0,212,255,0.08);
  border-color: rgba(0,212,255,0.28);
  color: #00d4ff;
}

/* ── Payout strip — compact ──────────────────────────────── */
.cds-payout-strip {
  margin: 0 16px;
  padding: 10px 16px;
  background: rgba(0,212,255,0.04);
  border: 1px solid rgba(0,212,255,0.1);
  border-radius: 12px;
  display: flex;
  align-items: center;
  transition: background 0.2s, border-color 0.2s;
}

.cds-payout-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.cds-payout-divider {
  width: 1px;
  height: 26px;
  background: rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.cds-payout-label {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(232,240,254,0.28);
}

.cds-payout-val {
  font-size: 0.92rem;
  font-weight: 800;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}
.cds-payout-val.cyan  { color: #00d4ff; }
.cds-payout-val.green { color: #00e5a0; }

/* ── AI banner — hidden by default, shown inline ─────────── */
.cds-ai-banner {
  margin: 6px 16px 0;
  background: linear-gradient(135deg, rgba(22,65,196,0.1), rgba(167,139,250,0.06));
  border: 1px solid rgba(167,139,250,0.18);
  border-radius: 10px;
  padding: 8px 12px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.cds-ai-icon {
  flex-shrink: 0;
  margin-top: 1px;
  display: flex;
  align-items: center;
}

.cds-ai-text {
  font-size: 0.68rem;
  color: rgba(232,240,254,0.5);
  line-height: 1.45;
}
.cds-ai-text strong { color: rgba(232,240,254,0.85); }
.cds-ai-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cds-ai-spinner {
  display: inline-block;
  width: 9px;
  height: 9px;
  border: 2px solid rgba(167,139,250,0.2);
  border-top-color: #a78bfa;
  border-radius: 50%;
  animation: cdsSpin 0.75s linear infinite;
  vertical-align: middle;
  margin-right: 4px;
}
@keyframes cdsSpin { to { transform: rotate(360deg); } }

/* ── Scrollable body (everything above footer) ──────────── */
.cds-slip-body {
  flex: 0 0 auto;
  overflow: visible;
}

/* ── Footer — always pinned at bottom, never clipped ──────── */
.cds-footer {
  flex-shrink: 0;
  padding: 10px 16px 16px;
  background: inherit;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.cds-place-btn {
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, #1641C4 0%, #0e2ea0 100%);
  border: 1px solid rgba(0,212,255,0.2);
  border-radius: 14px;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.03em;
  transition: all 0.22s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow:
    0 4px 24px rgba(22,65,196,0.45),
    0 0 0 1px rgba(0,212,255,0.08),
    inset 0 1px 0 rgba(255,255,255,0.08);
  position: relative;
  overflow: hidden;
}
.cds-place-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0,212,255,0.07) 0%, transparent 55%);
  pointer-events: none;
}
.cds-place-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #1e4fd4 0%, #1234b8 100%);
  transform: translateY(-1px);
  box-shadow: 0 8px 32px rgba(22,65,196,0.6), 0 0 20px rgba(0,212,255,0.1);
}
.cds-place-btn:active:not(:disabled) { transform: translateY(0); }
.cds-place-btn:disabled {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.07);
  color: rgba(232,240,254,0.2);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.cds-footer-note {
  text-align: center;
  font-size: 0.65rem;
  color: rgba(232,240,254,0.18);
  margin-top: 7px;
  line-height: 1.5;
  /* Never clip the Terms of Service link */
  white-space: normal;
  word-break: break-word;
  padding-bottom: 2px;
}
.cds-footer-note a { color: rgba(0,212,255,0.5); text-decoration: none; }
.cds-footer-note a:hover { color: #00d4ff; }

/* ── Full-content viewport fit: no internal prediction-slip scroll ─────── */
#cwDashSlipOverlay {
  overflow: hidden;
  padding: 12px;
}
#cwDashSlip {
  max-height: none;
  margin: auto;
  --cw-slip-scale: 1;
  transform: scale(var(--cw-slip-scale));
  transform-origin: center center;
  transition: transform 0.18s cubic-bezier(0.23, 1, 0.32, 1);
}
@media (max-width: 560px) {
  #cwDashSlip { width: min(460px, 100%); }
}

/* ── Success screen ──────────────────────────────────────── */
.cds-success-screen {
  padding: 32px 20px 28px;
  text-align: center;
}

.cds-success-ring {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 2px solid rgba(0,212,255,0.3);
  background: rgba(0,212,255,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  animation: cdsSuccessRing 0.5s ease;
}
@keyframes cdsSuccessRing {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.cds-success-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: #e8f0fe;
  margin-bottom: 6px;
}

.cds-success-detail {
  font-size: 0.84rem;
  color: rgba(232,240,254,0.45);
  line-height: 1.6;
  margin-bottom: 20px;
}
.cds-success-detail strong { color: rgba(232,240,254,0.85); }
.cds-success-detail em { font-style: normal; color: rgba(232,240,254,0.6); }

.cds-success-amounts {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 20px;
  text-align: left;
}

.cds-success-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.84rem;
  padding: 5px 0;
}
.cds-success-row + .cds-success-row { border-top: 1px solid rgba(255,255,255,0.05); }
.cds-success-row span { color: rgba(232,240,254,0.4); }
.cds-success-row strong { color: #e8f0fe; font-weight: 700; }

.cds-success-close {
  background: linear-gradient(135deg, #1641C4, #0e2ea0);
  border: 1px solid rgba(0,212,255,0.2);
  border-radius: 12px;
  padding: 12px 36px;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  box-shadow: 0 4px 18px rgba(22,65,196,0.4);
}
.cds-success-close:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(22,65,196,0.55);
}

/* ── Light mode ──────────────────────────────────────────── */
[data-theme="light"] #cwDashSlip {
  background:
    linear-gradient(180deg, rgba(22,65,196,0.03) 0%, transparent 35%),
    linear-gradient(160deg, #f2f5ff 0%, #eef1ff 50%, #f0f4ff 100%);
  border-color: rgba(22,65,196,0.12);
  border-top-color: rgba(22,65,196,0.3);
  color: #0d1628;
}
[data-theme="light"] .cds-question { color: #0d1628; }
[data-theme="light"] .cds-amount-wrap { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.1); }
[data-theme="light"] .cds-amount-input { color: #0d1628; }
[data-theme="light"] .cds-payout-val { color: #0d1628; }
[data-theme="light"] #cwDashSlipClose {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.08);
  color: rgba(13,22,40,0.4);
}

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 520px) {
  #cwDashSlip {
    border-radius: 20px;
    width: min(460px, calc(100vw - 24px));
  }
  #cwDashSlipOverlay { align-items: center; }
  .cds-pred-pct { font-size: 1.7rem; }
}

/* CSS fallback for browsers that delay viewport measurements while opening
   the dialog. The original scale remains untouched on normal/tall windows. */
@media (max-height: 900px) {
  #cwDashSlip { --cw-slip-scale: 0.78 !important; }
}

@media (max-height: 760px) {
  #cwDashSlip { --cw-slip-scale: 0.66 !important; }
}
