/* ============================================
   Outpost Corporate Model - Custom Styles
   GreenPoint Partners
   ============================================ */

/* ---------- Base ---------- */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Custom Scrollbar ---------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: #334155 transparent;
}

/* ---------- Tab Bar ---------- */
.tab-bar {
  display: flex;
  gap: 0;
}

.tab-btn {
  position: relative;
  padding: 0.75rem 1.25rem;
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: #94a3b8;
}

.tab-btn.active {
  color: #7ea8c4;
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: #435060;
  border-radius: 1px 1px 0 0;
}

/* ---------- Cards ---------- */
.card {
  background: #111827;
  border: 1px solid #1e293b;
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  border-color: #334155;
  box-shadow: 0 0 20px rgba(91, 126, 157, 0.03);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #1e293b;
}

.card-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #cbd5e1;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

/* ---------- Metric Cards ---------- */
.metric-card {
  background: #111827;
  border: 1px solid #1e293b;
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--card-accent, #5b7e9d), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.metric-card:hover {
  border-color: #334155;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.metric-card:hover::before {
  opacity: 1;
}

.metric-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.375rem;
}

.metric-value {
  font-size: 1.75rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.metric-sublabel {
  font-size: 0.6875rem;
  color: #475569;
  margin-top: 0.25rem;
}

/* IRR Color Classes */
.irr-excellent {
  color: #10b981;
  --card-accent: #10b981;
}

.irr-good {
  color: #34d399;
  --card-accent: #34d399;
}

.irr-moderate {
  color: #f59e0b;
  --card-accent: #f59e0b;
}

.irr-poor {
  color: #ef4444;
  --card-accent: #ef4444;
}

/* ---------- Input Groups ---------- */
.input-group {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 0.625rem;
  padding: 0.875rem 1rem;
}

.input-group-title {
  font-size: 0.6875rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #1e293b;
}

.input-row {
  margin-bottom: 0.75rem;
}

.input-row:last-child {
  margin-bottom: 0;
}

.input-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: #94a3b8;
}

.input-value {
  font-size: 0.75rem;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  color: #5b7e9d;
  background: #1e293b;
  padding: 0.125rem 0.5rem;
  border-radius: 0.25rem;
}

/* ---------- Select Input ---------- */
.input-select {
  width: 100%;
  margin-top: 0.375rem;
  padding: 0.5rem 0.75rem;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 0.375rem;
  color: #e2e8f0;
  font-size: 0.8125rem;
  font-family: 'JetBrains Mono', monospace;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

.input-select:hover {
  border-color: #5b7e9d;
}

.input-select:focus {
  border-color: #5b7e9d;
  box-shadow: 0 0 0 2px rgba(91, 126, 157, 0.15);
}

.input-select option {
  background: #1e293b;
  color: #e2e8f0;
}

/* ---------- Range Slider ---------- */
.input-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: #1e293b;
  border-radius: 2px;
  outline: none;
  margin-top: 0.5rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.input-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #5b7e9d;
  border: 2px solid #3d5871;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 0 0 0 rgba(91, 126, 157, 0);
}

.input-range::-webkit-slider-thumb:hover {
  background: #7ea8c4;
  transform: scale(1.15);
  box-shadow: 0 0 8px rgba(91, 126, 157, 0.4);
}

.input-range:active::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px rgba(91, 126, 157, 0.2);
}

.input-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #5b7e9d;
  border: 2px solid #3d5871;
  cursor: pointer;
  transition: all 0.15s ease;
}

.input-range::-moz-range-thumb:hover {
  background: #7ea8c4;
}

.input-range::-moz-range-track {
  background: #1e293b;
  height: 4px;
  border-radius: 2px;
}

.input-range-bounds {
  display: flex;
  justify-content: space-between;
  margin-top: 0.25rem;
  font-size: 0.625rem;
  color: #475569;
  font-family: 'JetBrains Mono', monospace;
}

/* ---------- Exit Segment Bars ---------- */
.segment-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.segment-label {
  width: 100px;
  flex-shrink: 0;
  font-size: 0.75rem;
  color: #94a3b8;
  text-align: right;
}

.segment-bar-container {
  flex: 1;
  height: 28px;
  background: #0f172a;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.segment-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 2px;
}

.segment-amount {
  width: 90px;
  flex-shrink: 0;
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  color: #cbd5e1;
  text-align: right;
}

.segment-bar.positive {
  background: linear-gradient(90deg, #3d5871, #5b7e9d);
}

.segment-bar.tech {
  background: linear-gradient(90deg, #059669, #10b981);
}

.segment-bar.ops {
  background: linear-gradient(90deg, #d97706, #f59e0b);
}

.segment-bar.negative {
  background: linear-gradient(90deg, #dc2626, #ef4444);
}

/* ---------- Sources & Uses ---------- */
.su-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0;
}

.su-label {
  color: #94a3b8;
  font-size: 0.8125rem;
}

.su-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  font-weight: 500;
}

.su-value.positive { color: #10b981; }
.su-value.negative { color: #ef4444; }
.su-value.neutral { color: #cbd5e1; }

.su-divider {
  border-top: 1px solid #334155;
  margin: 0.375rem 0;
}

.su-total {
  font-weight: 600;
  font-size: 0.875rem;
}

.su-total .su-label {
  color: #e2e8f0;
  font-weight: 600;
}

.su-total .su-value {
  font-size: 0.9375rem;
}

/* ---------- Charts ---------- */
.chart-container {
  position: relative;
  height: 340px;
  width: 100%;
}

.chart-container canvas {
  max-height: 100%;
}

/* ---------- Sensitivity Table ---------- */
.sensitivity-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 2px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
}

.sensitivity-table th {
  padding: 0.5rem 0.75rem;
  text-align: center;
  font-weight: 600;
  color: #94a3b8;
  background: #0f172a;
  border-radius: 4px;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sensitivity-table th.corner {
  background: transparent;
}

.sensitivity-table th.row-header {
  text-align: right;
  padding-right: 1rem;
}

.sensitivity-table td {
  padding: 0.5rem 0.75rem;
  text-align: center;
  border-radius: 4px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.sensitivity-table td:hover {
  transform: scale(1.05);
  z-index: 1;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
}

/* Sensitivity cell color classes */
.sens-excellent {
  background: rgba(16, 185, 129, 0.25);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.15);
}

.sens-good {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.1);
}

.sens-moderate {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.1);
}

.sens-weak {
  background: rgba(249, 115, 22, 0.15);
  color: #fb923c;
  border: 1px solid rgba(249, 115, 22, 0.1);
}

.sens-poor {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.1);
}

.sens-base {
  outline: 2px solid #5b7e9d;
  outline-offset: -1px;
  font-weight: 700;
}

/* ---------- Cash Flow Timeline ---------- */
.cf-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8125rem;
}

.cf-year {
  width: 50px;
  flex-shrink: 0;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  color: #64748b;
  text-align: right;
}

.cf-bar-container {
  flex: 1;
  height: 24px;
  position: relative;
  display: flex;
  align-items: center;
}

.cf-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: absolute;
}

.cf-bar.draw {
  background: linear-gradient(90deg, #dc2626, #ef4444);
  right: 50%;
  border-radius: 3px 0 0 3px;
}

.cf-bar.dist {
  background: linear-gradient(90deg, #10b981, #34d399);
  left: 50%;
  border-radius: 0 3px 3px 0;
}

.cf-center-line {
  position: absolute;
  left: 50%;
  top: -2px;
  bottom: -2px;
  width: 1px;
  background: #334155;
}

.cf-amount {
  width: 90px;
  flex-shrink: 0;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  text-align: right;
}

.cf-amount.draw { color: #f87171; }
.cf-amount.dist { color: #34d399; }

/* ---------- Live Dot Animation ---------- */
.live-dot {
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ---------- Transitions ---------- */
.fade-in {
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Print Styles ---------- */
@media print {
  body {
    background: white !important;
    color: #111827 !important;
  }

  .card, .metric-card, .input-group {
    background: white !important;
    border-color: #e5e7eb !important;
    box-shadow: none !important;
  }

  header {
    background: white !important;
    border-color: #e5e7eb !important;
  }

  .card-title, .input-group-title, .metric-label {
    color: #374151 !important;
  }

  .metric-value {
    color: #111827 !important;
  }

  #sidebar {
    display: none !important;
  }

  #mobileToggle {
    display: none !important;
  }

  main {
    padding: 0 !important;
  }

  .sensitivity-table th, .sensitivity-table td {
    border: 1px solid #d1d5db;
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 1023px) {
  #sidebar {
    position: fixed;
    top: 57px;
    left: 0;
    bottom: 0;
    z-index: 40;
    width: 320px;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #111827;
    overflow-y: auto;
  }

  #sidebar.open {
    transform: translateX(0);
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.5);
  }

  .chart-container {
    height: 220px;
  }
}

@media (max-width: 640px) {
  .metric-value {
    font-size: 1.375rem;
  }

  .segment-label {
    width: 70px;
    font-size: 0.6875rem;
  }

  .segment-amount {
    width: 70px;
    font-size: 0.6875rem;
  }
}

/* ---------- Loading State ---------- */
.skeleton {
  background: linear-gradient(90deg, #1e293b 0%, #334155 50%, #1e293b 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- Carry Calculator ---------- */
.carry-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

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

.carry-section {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 0.625rem;
  padding: 1rem 1.25rem;
}

.carry-section-title {
  font-size: 0.6875rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #1e293b;
}

.carry-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0;
}

.carry-label {
  color: #94a3b8;
  font-size: 0.8125rem;
}

.carry-amount {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  font-weight: 500;
}

.carry-amount.positive { color: #10b981; }
.carry-amount.negative { color: #ef4444; }
.carry-amount.neutral { color: #cbd5e1; }
.carry-amount.gp { color: #ef4444; }

.carry-divider {
  border-top: 1px solid #334155;
  margin: 0.375rem 0;
}

.carry-total {
  font-weight: 600;
}

.carry-total .carry-label {
  color: #e2e8f0;
  font-weight: 600;
}

.carry-total .carry-amount {
  font-size: 0.9375rem;
}

/* ---------- LP Returns Table ---------- */
.lp-returns-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.lp-returns-table th {
  text-align: right;
  padding: 0.375rem 0.75rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #1e293b;
}

.lp-returns-table th:first-child {
  text-align: left;
}

.lp-returns-table td {
  padding: 0.5rem 0.75rem;
  text-align: right;
  color: #cbd5e1;
  font-weight: 500;
}

.lp-returns-table td.row-label {
  text-align: left;
  color: #94a3b8;
  font-family: 'Inter', sans-serif;
}

.lp-returns-table tr.mip-row {
  border-top: 1px solid #334155;
}

.lp-returns-table tr.mip-row td {
  padding-top: 0.625rem;
  font-weight: 600;
  color: #e2e8f0;
}

/* ---------- A-1 Per Share ---------- */
.a1-basis-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0;
  margin-bottom: 0.25rem;
}

.a1-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0;
  margin-bottom: 0.25rem;
}

.a1-col-header {
  font-size: 0.6875rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: 'JetBrains Mono', monospace;
}

/* ---------- MIP Callout ---------- */
.mip-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0;
  margin-bottom: 0.25rem;
}

.mip-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mip-status-badge.mip-triggered {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.mip-status-badge.mip-below {
  background: rgba(100, 116, 139, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(100, 116, 139, 0.25);
}

/* ---------- Comparison Table (Combined Tab) ---------- */
.comparison-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.comparison-table thead th {
  padding: 0.625rem 1.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #334155;
  white-space: nowrap;
}

.comparison-table thead th:first-child {
  text-align: left;
  width: 140px;
}

.comparison-table thead th:not(:first-child) {
  text-align: right;
}

.comparison-table tbody td {
  padding: 0.5rem 1.25rem;
  border-bottom: 1px solid #1e293b;
  white-space: nowrap;
}

.comparison-table tbody td.row-label {
  text-align: left;
  color: #94a3b8;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
}

.comparison-table tbody td.font-mono {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  color: #cbd5e1;
}

.comparison-table tbody td.text-right {
  text-align: right;
}

.comparison-table tbody tr:hover {
  background: rgba(30, 41, 59, 0.5);
}

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

/* ---------- Per-Share Container (Combined Tab) ---------- */
.per-share-container {
  padding: 0.25rem 0.25rem;
}

.per-share-container .carry-row {
  padding: 0.4rem 0;
}

.per-share-container .carry-divider {
  margin: 0.5rem 0;
}

/* ---------- Combined Sidebar Summary Rows ---------- */
.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0;
  gap: 1rem;
}
.summary-row span:first-child {
  color: #94a3b8;
}
.summary-row span:last-child {
  text-align: right;
  white-space: nowrap;
}