/* Sinnema — Base Styles */

:root {
  --color-bg: #f8f9fa;
  --color-surface: #ffffff;
  --color-text: #212529;
  --color-text-muted: #6c757d;
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-success: #16a34a;
  --color-warning: #d97706;
  --color-danger: #dc2626;
  --color-border: #dee2e6;
  --radius: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  margin: 0;
  line-height: 1.5;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }

/* Navigation */
.navbar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0.75rem 0;
  margin-bottom: 2rem;
}
.navbar .container { display: flex; align-items: center; gap: 2rem; }
.navbar-brand { font-weight: 700; font-size: 1.25rem; color: var(--color-text); }
.navbar-nav { display: flex; gap: 1rem; list-style: none; margin: 0; padding: 0; }
.navbar-nav a { color: var(--color-text-muted); font-weight: 500; }
.navbar-nav a:hover { color: var(--color-primary); text-decoration: none; }

/* Page header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.page-header h1 { margin: 0; font-size: 1.5rem; }

/* Cards */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 1rem; }
.card-title { margin: 0 0 0.5rem; font-size: 1.1rem; }
.card-meta { color: var(--color-text-muted); font-size: 0.875rem; }

/* Metric cards grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.metric-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}
.metric-label { font-size: 0.75rem; text-transform: uppercase; color: var(--color-text-muted); letter-spacing: 0.05em; }
.metric-value { font-size: 1.5rem; font-weight: 700; margin-top: 0.25rem; }
.metric-value.positive { color: var(--color-success); }
.metric-value.negative { color: var(--color-danger); }

/* Scenario comparison grid */
.scenario-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-weight: 500;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}
.form-control {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  background: var(--color-surface);
}
.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
.form-control.is-invalid { border-color: var(--color-danger); }
.form-error { color: var(--color-danger); font-size: 0.75rem; margin-top: 0.25rem; }
.form-section { margin-bottom: 1.5rem; }
.form-section-title { font-size: 1rem; font-weight: 600; margin-bottom: 0.75rem; border-bottom: 1px solid var(--color-border); padding-bottom: 0.5rem; }
.form-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }

select.form-control { appearance: auto; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-outline { background: transparent; border-color: var(--color-border); color: var(--color-text); }
.btn-outline:hover { background: var(--color-bg); }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.8rem; }

/* HTMX indicators */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline; }
.htmx-request.htmx-indicator { display: inline; }

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.table th, .table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
}
.table th { font-weight: 600; color: var(--color-text-muted); font-size: 0.75rem; text-transform: uppercase; }
.table td.number { text-align: right; font-variant-numeric: tabular-nums; }
.table th.number { text-align: right; }

/* Toast notifications */
#toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  color: #fff;
  font-size: 0.875rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: toast-in 0.3s ease;
}
.toast-success { background: var(--color-success); }
.toast-error { background: var(--color-danger); }
.toast-warning { background: var(--color-warning); }
.toast-info { background: var(--color-primary); }

@keyframes toast-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Chart container */
.chart-container { position: relative; width: 100%; margin: 1.5rem 0; }
.chart-container canvas { max-height: 400px; }

/* Table container for horizontal scroll */
.table-container { overflow-x: auto; margin-bottom: 1rem; }

/* Details/summary for collapsible sections */
details summary { cursor: pointer; padding: 0.25rem 0; }
details summary:hover { color: var(--color-primary); }

/* Utilities */
.text-muted { color: var(--color-text-muted); }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-2 { margin-bottom: 1rem; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--color-text-muted); }

/* Tax comparison */
.disclaimer-banner {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  color: #92400e;
  font-weight: 500;
  font-size: 0.875rem;
}
.tax-best { background: rgba(22, 163, 74, 0.08); }
.tax-unavailable { color: var(--color-text-muted); background: var(--color-bg); }
