/* Rewritable Design System - Modern Professional Theme */

:root {
  /* Core Surfaces & Text */
  --bg: #FFFFFF;
  --bg-elev: #FFFFFF;
  --text: #0D0F16;
  --text-muted: #4B5563;
  --border: #E9EAEC;

  /* Complete Neutral Scale */
  --neutral-50: #FAFAFA;
  --neutral-100: #F5F5F6;
  --neutral-200: #E9EAEC;
  --neutral-300: #DADCE1;
  --neutral-400: #BFC3C9;
  --neutral-500: #9AA0A6;
  --neutral-600: #6B7280;
  --neutral-700: #4B5563;
  --neutral-800: #2F3541;
  --neutral-900: #171923;
  --neutral-950: #0D0F16;

  /* Brand Colors - Indigo (Authority & Tech Trust) */
  --brand-300: #A3A6FF;
  --brand-400: #878BFF;
  --brand-500: #6E70F2;
  --brand-600: #5B5BD6;
  --brand-700: #4444B2;

  /* Semantic Colors */
  --green-600: #16A34A;
  --amber-600: #D97706;
  --red-600: #E5484D;
  --blue-600: #2F81F7;

  /* Shape & Motion */
  --radius-card: 16px;
  --radius-input: 8px;
  --radius-pill: 9999px;
  
  /* Shadows */
  --shadow-light: 0 1px 0 rgba(13,15,22,0.04), 0 8px 24px rgba(13,15,22,0.06);
  --shadow-dark: 0 1px 0 rgba(0,0,0,0.4), 0 8px 24px rgba(0,0,0,0.45);
  
  /* Motion */
  --duration-micro: 160ms;
  --duration-short: 220ms;
  --easing: ease-out;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0D0F16;
    --bg-elev: #111522;
    --text: #F5F5F6;
    --text-muted: #BFC3C9;
    --border: #2A2F3B;
    
    /* Adjust brand colors for dark mode */
    --brand-500: #878BFF;
    --brand-600: #6E70F2;
  }
}

/* Typography System */
html {
  font-family: "Geist Variable", "Inter Variable", Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
  font-feature-settings: "ss01", "cv02", "tnum";
  line-height: 1.5;
}

/* Typography Scale */
.text-h1 {
  font-size: 2.75rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
}

.text-h2 {
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.15;
  color: var(--text);
}

.text-h3 {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.15;
  color: var(--text);
}

.text-h4 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.15;
  color: var(--text);
}

.text-body {
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text);
}

.text-small {
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-muted);
}

.text-micro {
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text-muted);
}

/* Button System */
.btn-primary {
  display: inline-flex;
  align-items: center;
  height: 3rem;
  padding: 0 1.5rem;
  border-radius: var(--radius-card);
  background-color: var(--brand-600);
  color: #FFFFFF;
  font-weight: 500;
  font-size: 1rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-light);
  transition: all var(--duration-micro) var(--easing);
}

.btn-primary:hover {
  background-color: var(--brand-700);
  transform: translateY(-1px);
}

.btn-primary:active {
  background-color: var(--brand-700);
  box-shadow: inset 0 1px 0 rgba(0,0,0,0.1);
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  height: 3rem;
  padding: 0 1.5rem;
  border-radius: var(--radius-card);
  background-color: var(--bg);
  color: var(--text);
  font-weight: 500;
  font-size: 1rem;
  text-decoration: none;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--duration-micro) var(--easing);
}

.btn-secondary:hover {
  background-color: var(--neutral-50);
}

.btn-quiet {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  background: none;
  color: var(--brand-600);
  font-weight: 500;
  font-size: 1rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all var(--duration-micro) var(--easing);
}

.btn-quiet:hover {
  text-decoration: underline;
}

/* Input System */
.input, .textarea {
  height: 2.75rem;
  padding: 0 0.75rem;
  border-radius: var(--radius-input);
  border: 1px solid var(--border);
  background-color: var(--bg);
  color: var(--text);
  font-size: 1rem;
  transition: all var(--duration-micro) var(--easing);
}

.textarea {
  height: auto;
  padding: 0.75rem;
  min-height: 5rem;
  resize: vertical;
}

.input:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand-400);
  box-shadow: 0 0 0 2px var(--brand-300);
}

.input::placeholder, .textarea::placeholder {
  color: var(--neutral-500);
}

/* Card System */
.card {
  background-color: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-light);
  padding: 1.5rem;
  transition: all var(--duration-short) var(--easing);
}

.card:hover {
  box-shadow: 0 1px 0 rgba(13,15,22,0.04), 0 12px 32px rgba(13,15,22,0.08);
  transform: translateY(-2px);
}

.card-header {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.card-body {
  font-size: 1rem;
  font-weight: 400;
  color: var(--text);
  line-height: 1.5;
}

.card-meta {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* Badge System */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.875rem;
  font-weight: 500;
}

.badge-default {
  background-color: var(--neutral-100);
  color: var(--neutral-700);
}

.badge-favorable {
  background-color: #E6F6EC;
  color: var(--green-600);
}

.badge-review {
  background-color: #FFF4E5;
  color: var(--amber-600);
}

.badge-risky {
  background-color: #FDECEC;
  color: var(--red-600);
}

.badge-info {
  background-color: #EBF4FF;
  color: var(--blue-600);
}

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

.table th,
.table td {
  height: 2.75rem;
  padding: 0 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  font-weight: 600;
  color: var(--text);
  background-color: var(--neutral-50);
}

.table td {
  font-weight: 400;
  color: var(--text);
}

.table tbody tr:nth-child(even) {
  background-color: var(--neutral-50);
}

.table tbody tr:hover {
  background-color: var(--neutral-50);
}

.table tbody tr.selected {
  border-left: 3px solid var(--brand-600);
}

/* Numeric columns for tables */
.table-numeric {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* Focus Ring System */
.focus-ring:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--brand-400), 0 0 0 1px var(--border);
}

/* CTA Gradient (use sparingly) */
.btn-gradient {
  background: linear-gradient(90deg, var(--brand-600), var(--brand-500));
}

.btn-gradient:hover {
  background: linear-gradient(90deg, var(--brand-700), var(--brand-600));
}

/* Utility Classes */
.transition-micro {
  transition: all var(--duration-micro) var(--easing);
}

.transition-short {
  transition: all var(--duration-short) var(--easing);
}

.shadow-soft {
  box-shadow: var(--shadow-light);
}

.rounded-card {
  border-radius: var(--radius-card);
}

.rounded-input {
  border-radius: var(--radius-input);
}

.rounded-pill {
  border-radius: var(--radius-pill);
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
  .shadow-soft {
    box-shadow: var(--shadow-dark);
  }
  
  .card:hover {
    box-shadow: 0 1px 0 rgba(0,0,0,0.4), 0 12px 32px rgba(0,0,0,0.5);
  }
}