/* K2 Capital - Portfolio Page Styles (Prairie Home Companion Edition) */

/* Summary Cards */
.summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.summary-card {
  background: #fff;
  border: 1px solid var(--color-parchment);
  padding: 1.5rem;
  border-radius: 8px;
}

.summary-label {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-ink-muted);
  margin-bottom: 0.5rem;
}

.summary-value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--color-ink);
}

.summary-value.positive {
  color: var(--color-gain);
}

.summary-value.negative {
  color: var(--color-loss);
}

/* Holdings Section */
.holdings-section {
  margin-bottom: 3rem;
}

/* Light background for holdings tables */
.holdings-section table,
#holdings table {
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--color-parchment);
  overflow: hidden;
  border-collapse: separate;
  border-spacing: 0;
}

.holdings-section table thead,
#holdings table thead {
  background: #d4c4a8;
}

.holdings-section table thead th,
#holdings table thead th {
  color: var(--color-ink);
  border-bottom: 2px solid #b8a888;
}

.holdings-section table tbody tr:nth-child(even),
#holdings table tbody tr:nth-child(even) {
  background: #f8f4ee;
}

.holdings-section table tbody tr,
#holdings table tbody tr {
  border-bottom: 1px solid #e0d6c8;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-parchment);
}

.section-title-row {
  display: flex;
  align-items: baseline;
  gap: 1rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-barn-red);
}

.section-total {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-ink);
}

.section-pct {
  color: var(--color-ink-light);
  font-size: 1rem;
  font-weight: 400;
  margin-left: 0.25rem;
}

/* Collapsible sections */
.section-toggle {
  background: transparent;
  border: 1px solid var(--color-parchment);
  color: var(--color-ink-light);
  font-family: var(--font-body);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  padding: 0.5rem 1rem;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.section-toggle:hover {
  border-color: var(--color-barn-red);
  color: var(--color-barn-red);
}

.collapsible-table {
  display: none;
}

.collapsible-table.expanded {
  display: table;
}

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
}

th {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-ink-light);
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--color-parchment);
  background: var(--color-cream);
}

th.num {
  text-align: right;
}

td {
  font-size: 0.875rem;
  padding: 1rem;
  border-bottom: 1px solid var(--color-parchment);
  color: var(--color-ink);
}

td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-data);
}

td.symbol {
  font-weight: 600;
  color: var(--color-barn-red);
}

td.description {
  color: var(--color-ink);
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

td.positive {
  color: var(--color-gain);
}

td.negative {
  color: var(--color-loss);
}

tr:hover td {
  background: var(--color-cream-dark);
}

/* Income Summary Section */
.income-summary {
  margin-bottom: 3rem;
}

.section-subtitle {
  font-size: 0.875rem;
  color: var(--color-ink-muted);
}

.income-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.income-card {
  background: #fff;
  border: 1px solid var(--color-parchment);
  padding: 1.25rem;
  border-radius: 8px;
}

.income-label {
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-ink-muted);
  margin-bottom: 0.375rem;
}

.income-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-ink);
}

/* Wide income card with subsections */
.income-card-wide {
  grid-column: span 2;
}

.income-subsections {
  display: flex;
}

.income-subsection {
  flex: 1;
  padding: 0 1.5rem;
}

.income-subsection:first-child {
  padding-left: 0;
  border-right: 1px solid var(--color-parchment);
}

.income-subsection:last-child {
  padding-right: 0;
}

.income-chart-wrapper {
  margin-bottom: 2rem;
  background: #fff;
  border: 1px solid var(--color-parchment);
  border-radius: 8px;
  padding: 1rem;
}

.income-breakdown-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--color-parchment);
  overflow: hidden;
}

.income-breakdown-table th {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-ink-light);
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--color-parchment);
  background: var(--color-cream);
}

.income-breakdown-table th.num {
  text-align: right;
}

.income-breakdown-table td {
  font-size: 0.875rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-parchment);
  color: var(--color-ink);
}

.income-breakdown-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-data);
}

.income-breakdown-table tfoot td {
  border-bottom: none;
  border-top: 2px solid var(--color-parchment);
  color: var(--color-barn-red);
  font-weight: 600;
}

.income-breakdown-table thead {
  background: #d4c4a8;
}

.income-breakdown-table thead th {
  color: var(--color-ink);
  border-bottom: 2px solid #b8a888;
}

.income-breakdown-table tbody tr:nth-child(even) {
  background: #f8f4ee;
}

.income-breakdown-table tbody tr {
  border-bottom: 1px solid #e0d6c8;
}

.income-breakdown-table tbody tr:hover td {
  background: var(--color-cream-dark);
}

/* Collapsible content */
.collapsible-content {
  display: none;
}

.collapsible-content.expanded {
  display: block;
}

/* Info icon */
.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-ink-muted);
  background: var(--color-parchment);
  border-radius: 50%;
  cursor: help;
  margin-left: 0.25rem;
  vertical-align: middle;
}

/* Light info toggle button */
.info-toggle-light {
  background: none;
  border: 1px solid var(--color-parchment);
  color: var(--color-ink-muted);
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.info-toggle-light:hover {
  background: var(--color-cream-dark);
  border-color: var(--color-ink-light);
  color: var(--color-ink);
}

/* Inline info content */
.info-content-inline {
  display: none;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  background: #fff;
  border: 1px solid var(--color-parchment);
  border-radius: 8px;
}

.info-content-inline.expanded {
  display: block;
}

.info-section {
  margin-bottom: 1rem;
}

.info-section:last-child {
  margin-bottom: 0;
}

.info-section h4 {
  color: var(--color-barn-red);
  font-size: 0.875rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
}

.info-section p {
  color: var(--color-ink-light);
  font-size: 0.8125rem;
  line-height: 1.5;
  margin: 0;
}

/* Below chart actions */
.below-chart-actions {
  margin-top: 1rem;
  text-align: center;
}

/* Performance Section */
.performance-section {
  margin-bottom: 3rem;
}

.performance-section .section-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}

.performance-section .section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.period-filters {
  display: flex;
  gap: 0.5rem;
}

.period-btn {
  background: transparent;
  border: 1px solid var(--color-parchment);
  color: var(--color-ink-muted);
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-family: var(--font-body);
  letter-spacing: 0.05em;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.period-btn:hover {
  background: var(--color-cream-dark);
  border-color: var(--color-ink-light);
  color: var(--color-ink);
}

.period-btn.active {
  background: rgba(139, 58, 58, 0.1);
  border-color: var(--color-barn-red);
  color: var(--color-barn-red);
}

.performance-section .section-subtitle {
  font-size: 0.8125rem;
  color: var(--color-ink-muted);
}

.performance-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.performance-card {
  background: #fff;
  border: 1px solid var(--color-parchment);
  padding: 1.5rem;
  border-radius: 8px;
  text-align: center;
}

.perf-label {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-ink-muted);
  margin-bottom: 0.5rem;
}

.perf-value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--color-ink);
}

.perf-value.positive {
  color: var(--color-gain);
}

.perf-value.negative {
  color: var(--color-loss);
}

.performance-card.portfolio .perf-value {
  color: var(--color-wheat-gold);
}

.performance-card.benchmark .perf-value {
  color: var(--color-neutral);
}

.performance-card.difference .perf-value.positive {
  color: var(--color-gain);
}

.performance-card.difference .perf-value.negative {
  color: var(--color-loss);
}

.performance-chart-wrapper {
  background: #fff;
  border: 1px solid var(--color-parchment);
  border-radius: 8px;
  padding: 1rem;
}

#performanceChart {
  width: 100%;
  height: auto;
  min-height: 300px;
}

.perf-axis text {
  fill: var(--color-ink-muted);
  font-size: 11px;
}

.perf-axis line,
.perf-axis path {
  stroke: var(--color-parchment);
}

/* Responsive */
@media (max-width: 1024px) {
  .summary {
    grid-template-columns: repeat(2, 1fr);
  }

  .income-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .performance-summary {
    grid-template-columns: repeat(3, 1fr);
  }
}

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

  .income-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .performance-summary {
    grid-template-columns: 1fr;
  }

  .performance-card {
    padding: 1rem;
  }

  .perf-value {
    font-size: 1.5rem;
  }

  table {
    font-size: 0.8125rem;
  }

  th, td {
    padding: 0.75rem 0.5rem;
  }

  td.description {
    max-width: 150px;
  }
}
