/* ═══════════════════════════════════════════════════════════════════
   TRADETRACKER — RISK CALCULATOR STYLES
   ═══════════════════════════════════════════════════════════════════ */

/* ── Panel layout ──────────────────────────────────────────────── */
.rc-panel {
  padding: 24px 28px 40px;
  max-width: 1400px;
  margin: 0 auto;
}

.rc-header {
  margin-bottom: 24px;
}

.rc-header-title {
  font-family: var(--title);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.4px;
}

.rc-header-subtitle {
  font-family: var(--title);
  font-size: 12px;
  color: var(--text3);
  margin-top: 4px;
}

/* ── Global inputs card ────────────────────────────────────────── */
.rc-globals {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  padding: 18px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.rc-global-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 140px;
}

.rc-global-label {
  font-family: var(--title);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text3);
}

.rc-global-input {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  outline: none;
  transition: border-color 0.15s;
  width: 160px;
}

.rc-global-input:focus {
  border-color: var(--blue);
}

.rc-global-input::placeholder {
  color: var(--text3);
}

/* Remove number input arrows for global inputs too */
.rc-global-input::-webkit-inner-spin-button,
.rc-global-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.rc-global-input { -moz-appearance: textfield; }

.rc-global-result {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 140px;
}

.rc-global-result-label {
  font-family: var(--title);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text3);
}

.rc-global-result-value {
  height: 38px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--green-dim);
  border-radius: 7px;
  background: var(--green-dim);
  color: var(--green);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.rc-global-sep {
  width: 1px;
  height: 38px;
  background: var(--border);
  align-self: flex-end;
}

/* ── Mode toggle (SHORT / LONG) ───────────────────────────────── */
.rc-mode-toggle {
  display: flex;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
  background: var(--surface3);
}

.rc-mode-btn {
  flex: 1;
  padding: 0 16px;
  border: none;
  background: transparent;
  color: var(--text3);
  font-family: var(--title);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.rc-mode-btn:hover {
  color: var(--text2);
  background: var(--surface2);
}

.rc-mode-btn.active {
  color: #fff;
  background: var(--red);
}

.rc-mode-btn:first-child.active {
  background: var(--red);
}

.rc-mode-btn:last-child.active {
  background: var(--green);
}

/* ── Actions bar ──────────────────────────────────────────────── */
.rc-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.rc-btn {
  height: 34px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface2);
  color: var(--text2);
  font-family: var(--title);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.rc-btn:hover {
  border-color: var(--border2);
  color: var(--text);
  background: var(--surface3);
}

.rc-btn-primary {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.rc-btn-primary:hover {
  background: var(--green);
  opacity: 0.9;
  color: #fff;
  border-color: var(--green);
}

/* ── Table ────────────────────────────────────────────────────── */
.rc-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  position: relative;
  z-index: 0;  /* contain stacking context so sticky headers don't bleed over sidebar */
}

.rc-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1100px;
}

.rc-table thead th {
  font-family: var(--title);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text3);
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--surface2);
  position: sticky;
  top: 0;
  z-index: 2;
}

.rc-table thead th:first-child {
  border-radius: 10px 0 0 0;
}

.rc-table thead th:last-child {
  border-radius: 0 10px 0 0;
}

.rc-row {
  transition: background 0.12s;
}

.rc-row:hover {
  background: var(--surface2);
}

.rc-row:not(:last-child) .rc-cell {
  border-bottom: 1px solid var(--border);
}

.rc-cell {
  padding: 8px 10px;
  vertical-align: middle;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text2);
  white-space: nowrap;
}

.rc-cell-input {
  padding: 6px 6px;
}

.rc-cell-calc {
  font-weight: 500;
  color: var(--text);
}

.rc-cell-shares {
  font-weight: 700;
  color: var(--blue);
}

.rc-cell-profit.rc-positive {
  color: var(--green);
  font-weight: 600;
}

.rc-cell-rr {
  font-weight: 600;
}

.rc-cell-diff {
  color: var(--text3);
  font-size: 11px;
}

.rc-cell-action {
  text-align: center;
  padding: 6px;
}

/* ── Inputs inside table ──────────────────────────────────────── */
.rc-input {
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface3);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}

.rc-input:focus {
  border-color: var(--blue);
}

.rc-input::placeholder {
  color: var(--text3);
}

.rc-input-ticker {
  text-transform: uppercase;
  font-weight: 600;
  width: 90px;
  font-family: var(--title);
}

.rc-input-num {
  width: 85px;
  text-align: right;
}

.rc-input-pct {
  width: 65px;
}

/* Remove number input arrows */
.rc-input-num::-webkit-inner-spin-button,
.rc-input-num::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.rc-input-num {
  -moz-appearance: textfield;
}

/* ── Remove button ────────────────────────────────────────────── */
.rc-btn-remove {
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--text3);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rc-btn-remove:hover {
  background: var(--red-dim);
  color: var(--red);
}

/* ── Column header hints ──────────────────────────────────────── */
.rc-th-hint {
  display: block;
  font-weight: 400;
  font-size: 9px;
  color: var(--text3);
  letter-spacing: 0.3px;
  text-transform: none;
  margin-top: 2px;
  opacity: 0.7;
}

/* ── Info note ────────────────────────────────────────────────── */
.rc-info {
  margin-top: 16px;
  padding: 12px 16px;
  background: var(--blue-dim);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--title);
  font-size: 11px;
  color: var(--text2);
  line-height: 1.6;
}

.rc-info strong {
  color: var(--text);
}

.rc-info em {
  font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .rc-panel {
    padding: 16px 12px 32px;
  }

  .rc-globals {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 14px 16px;
  }

  .rc-global-field {
    min-width: 0;
  }

  .rc-global-input {
    width: 100%;
  }

  .rc-global-sep {
    display: none;
  }

  .rc-global-result {
    min-width: 0;
  }

  .rc-global-result-value {
    width: 100%;
  }

  .rc-mode-toggle {
    width: 100%;
  }

  .rc-header-title {
    font-size: 18px;
  }

  .rc-table-wrap {
    border-radius: 8px;
  }

  .rc-table {
    min-width: unset;
  }

  .rc-table thead {
    display: none;
  }

  .rc-table tbody {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
  }

  .rc-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px;
    background: var(--surface2);
    border-radius: 8px;
    border: 1px solid var(--border);
    position: relative;
  }

  .rc-row:hover {
    background: var(--surface3);
  }

  .rc-row .rc-cell {
    border-bottom: none !important;
    padding: 4px 0;
  }

  .rc-cell-input {
    width: calc(50% - 4px);
  }

  .rc-cell-calc {
    width: calc(50% - 4px);
    font-size: 12px;
  }

  .rc-cell-action {
    position: absolute;
    top: 8px;
    right: 8px;
  }

  .rc-input {
    width: 100%;
    font-size: 14px;
  }

  .rc-input-ticker {
    width: 100%;
  }

  .rc-input-num,
  .rc-input-pct {
    width: 100%;
  }

  .rc-cell::before {
    content: attr(data-label);
    display: block;
    font-family: var(--title);
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text3);
    margin-bottom: 3px;
  }

  .rc-info {
    font-size: 11px;
  }
}
