/* ── Compound Interest Calculator — tool-specific styles ─────────────────────
   Global styles are inherited from /css/style.css.
   All colours reference CSS custom properties where possible.
   ─────────────────────────────────────────────────────────────────────────── */

/* ── Layout ──────────────────────────────────────────────────────────────── */
.ci-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 768px) {
  .ci-layout {
    grid-template-columns: 1fr;
  }
}

/* ── Inputs panel ─────────────────────────────────────────────────────────── */
.ci-inputs {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card, 8px);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.ci-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.ci-field--row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.ci-field-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.ci-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  flex-shrink: 0;
}

.ci-number-input {
  width: 110px;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-control, 6px);
  background: var(--bg-input, var(--bg-card));
  color: var(--text-primary);
  font-size: 0.875rem;
  text-align: right;
}

.ci-number-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring, rgba(37, 99, 235, 0.12));
}

.ci-slider {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.ci-select {
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-control, 6px);
  background: var(--bg-input, var(--bg-card));
  color: var(--text-primary);
  font-size: 0.875rem;
  cursor: pointer;
}

.ci-select--currency {
  width: 110px;
}

.ci-select:focus {
  outline: none;
  border-color: var(--accent);
}

.ci-reset-btn {
  margin-top: 0.25rem;
  align-self: flex-start;
}

/* ── Results panel ────────────────────────────────────────────────────────── */
.ci-results {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Summary cards */
.ci-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 480px) {
  .ci-cards {
    grid-template-columns: 1fr;
  }
}

.ci-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card, 8px);
  padding: 0.875rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  box-shadow: var(--shadow-sm);
}

.ci-card-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.ci-card-value {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--accent);
  word-break: break-all;
}

/* Rule of 72 */
.ci-rule72 {
  background: var(--accent-light, rgba(37, 99, 235, 0.08));
  border: 1px solid var(--accent);
  border-radius: var(--radius-card, 8px);
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.5;
}

/* Chart */
.ci-chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card, 8px);
  overflow: hidden;
  width: 100%;
}

#ci-chart {
  display: block;
  width: 100%;
  height: 280px;
}

/* Table toggle */
.ci-table-toggle-row {
  display: flex;
}

/* Breakdown table */
.ci-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card, 8px);
  overflow: hidden;
}

.ci-table-heading {
  padding: 0.875rem 1rem 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.ci-table-scroll {
  overflow-x: auto;
}

.ci-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.ci-table th {
  background: var(--bg-hover, #f5f5f5);
  color: var(--text-secondary);
  font-weight: 600;
  text-align: right;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.ci-table th:first-child {
  text-align: center;
}

.ci-table td {
  padding: 0.45rem 0.75rem;
  text-align: right;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.ci-table td:first-child {
  text-align: center;
  font-weight: 600;
  color: var(--text-secondary);
}

.ci-table tbody tr:nth-child(even) {
  background: var(--bg-hover, #f5f5f5);
}

.ci-table tbody tr:last-child td {
  border-bottom: none;
}

/* Related tools */
.ci-related-section h2 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.875rem;
}

.ci-related-grid {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.ci-related-card {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card, 8px);
  text-decoration: none;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.ci-related-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-card-hover);
}

.ci-related-icon {
  font-size: 1.1rem;
}

/* Tooltip (drawn on canvas, no CSS needed) */
