@charset "UTF-8";

/* Reset & Base Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-primary: #0f1218;
  --bg-secondary: #141720;
  --bg-surface: #1e2430;
  --border-color: #272f3e;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --accent-amber: #eab308;
  --accent-sky: #38bdf8;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  user-select: none;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.app-header {
  background-color: #0b0d13;
  border-bottom: 1px solid var(--border-color);
  padding: 6px 16px 0 16px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

.brand-container {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding-bottom: 7px;
}

.brand-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.025em;
  margin: 0;
  white-space: nowrap;
}

.brand-sub {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Tab Navigation - Authentic Tab Bar Appearance */
.tab-nav {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  background: transparent;
  padding: 0;
  margin: 0;
  position: relative;
}

.tab-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 16px;
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  font-size: 12px;
  font-weight: 600;
  color: #8da2be;
  background-color: #11151f;
  border: 1px solid #202838;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  margin-bottom: -1px;
}

.tab-btn:hover {
  color: #f1f5f9;
  background-color: #171f2e;
  border-color: #2b384f;
}

.tab-btn-active {
  color: #ffffff !important;
  background-color: #0f1218 !important; /* seamlessly matches canvas section below */
  border-color: #334155 !important;
  border-top: 2.5px solid var(--tab-accent, #38bdf8) !important;
  border-bottom: 1px solid #0f1218 !important; /* physically opens down into content */
  font-weight: 700 !important;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.45);
  z-index: 2;
  height: 34px;
}

/* Tiny (?) Help Button */
.help-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #1e293b;
  border: 1px solid #475569;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  cursor: pointer;
  margin-bottom: 6px;
}

.help-btn:hover {
  background: #334155;
  border-color: #64748b;
  color: #ffffff;
  transform: scale(1.05);
}

@media (max-width: 640px) {
  .app-header {
    padding: 6px 10px 0 10px;
    gap: 6px;
  }

  .brand-container {
    padding-bottom: 5px;
    gap: 0;
  }

  .brand-title {
    font-size: 1.15rem;
  }

  .brand-sub {
    display: none !important;
  }

  .tab-nav {
    gap: 2px;
  }

  .tab-btn {
    height: 28px;
    padding: 0 8px;
    font-size: 11px;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
  }

  .tab-btn-active {
    height: 30px;
  }

  .help-btn {
    width: 22px;
    height: 22px;
    font-size: 11px;
    margin-bottom: 5px;
  }
}

/* Chart Canvas Section (Maximizing real estate) */
.chart-section {
  position: relative;
  width: 100%;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.chart-wrapper {
  position: relative;
  width: 100%;
  height: 58vh;
  min-height: 380px;
  max-height: 620px;
  cursor: crosshair;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

canvas#tci-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Controls Toggles & Stepper Styles */
.toggle-infusion-active {
  background-color: #ffff00 !important;
  color: #000000 !important;
  border-color: #ffff00 !important;
  font-weight: 800 !important;
  box-shadow: 0 0 12px rgba(255, 255, 0, 0.45) !important;
}

.time-step-btn {
  background-color: #334155 !important;
  color: #f8fafc !important;
  border: 1px solid #475569 !important;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.time-step-btn:hover {
  background-color: #475569 !important;
  color: #ffffff !important;
}

.time-span-badge {
  color: #38bdf8 !important;
  font-weight: 800;
  font-size: 12px;
  min-width: 28px;
  text-align: center;
  display: inline-block;
}

.stepper-group {
  height: 36px;
  min-height: 36px;
  box-sizing: border-box;
}

.stepper-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 14px;
  font-weight: 800;
  width: 30px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.stepper-btn:hover {
  background-color: #334155;
  color: #ffffff;
}

.stepper-input {
  text-align: center;
  border: none;
  background: transparent;
  color: #f1f5f9;
  font-weight: 600;
  font-size: 13px;
  height: 100%;
  width: 100%;
}

/* Sex Toggle Explicit Container and Buttons */
.sex-toggle-container {
  height: 36px;
  min-height: 36px;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 3px;
  background-color: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  align-items: stretch;
}

.sex-btn {
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 12px;
  border: none !important;
  outline: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sex-btn-male-active {
  background-color: #2563eb !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.45) !important;
}

.sex-btn-female-active {
  background-color: #ec4899 !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 0 10px rgba(236, 72, 153, 0.45) !important;
}

.sex-btn-inactive {
  background-color: transparent !important;
  color: #64748b !important;
  font-weight: 500 !important;
}

.sex-btn-inactive:hover {
  color: #94a3b8 !important;
  background-color: rgba(255, 255, 255, 0.04) !important;
}

/* PK Inputs: Pure White Text on Dark Background */
.pk-param-input {
  background-color: #1e293b !important;
  color: #ffffff !important;
  border: 1px solid #334155 !important;
  font-weight: 700 !important;
}

.pk-param-input:focus {
  border-color: #10b981 !important;
  outline: none !important;
}

/* Controls Section */
.controls-section {
  width: 100%;
}

/* Main Content */
.main-content {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 12px 16px;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

/* Dialog / Modal */
.help-dialog {
  border: none;
  background: transparent;
  padding: 0;
  margin: auto;
  max-width: 520px;
  width: 90%;
  color: var(--text-primary);
}

.help-dialog::backdrop {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.help-dialog-content {
  background: #151922;
  border: 1px solid #334155;
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.help-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #272f3e;
}

.help-dialog-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #f1f5f9;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.close-btn:hover {
  color: #fff;
  background: #334155;
}

.help-dialog-body {
  padding: 16px 20px;
  font-size: 0.85rem;
  color: #cbd5e1;
  line-height: 1.6;
}

.help-dialog-body ul {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.help-dialog-body strong {
  color: #38bdf8;
}

/* Color Scheme Theme Selector */
.theme-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background-color: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  color: #f1f5f9;
  font-size: 12px;
  font-weight: 600;
  user-select: none;
}

.theme-btn:hover {
  background-color: #334155;
  border-color: #475569;
}

.theme-btn.active {
  border-color: #38bdf8 !important;
  background-color: rgba(56, 189, 248, 0.14) !important;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.theme-swatches {
  display: flex;
  align-items: center;
  gap: 5px;
}

.theme-swatch {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  display: inline-block;
}

/* Layout Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-1\.5 { gap: 0.375rem; }
.gap-2 { gap: 0.5rem; }
.gap-2\.5 { gap: 0.625rem; }
.gap-3 { gap: 0.75rem; }
.gap-3\.5 { gap: 0.875rem; }
.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }
.overflow-x-auto { overflow-x: auto; }
.grid { display: grid; }

.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.col-span-2 { grid-column: span 2 / span 2; }

@media (min-width: 640px) {
  .sm\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sm\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sm\:col-span-1 { grid-column: span 1 / span 1; }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .lg\:grid-cols-7 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
}

.p-0\.5 { padding: 0.125rem; }
.p-1 { padding: 0.25rem; }
.p-4 { padding: 1rem; }
.px-1\.5 { padding-left: 0.375rem; padding-right: 0.375rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-2\.5 { padding-left: 0.625rem; padding-right: 0.625rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-0\.5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2\.5 { padding-top: 0.625rem; padding-bottom: 0.625rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-3\.5 { margin-bottom: 0.875rem; }
.mt-3\.5 { margin-top: 0.875rem; }
.text-\[10px\] { font-size: 10px; }
.text-\[11px\] { font-size: 11px; }

.rounded { border-radius: 0.25rem; }
.rounded-md { border-radius: 0.375rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-full { border-radius: 9999px; }

.bg-slate-900 { background-color: #0f172a; }
.bg-slate-900\/90 { background-color: rgba(15, 23, 42, 0.9); }
.bg-slate-800 { background-color: #1e293b; }
.bg-slate-800\/60 { background-color: rgba(30, 41, 59, 0.6); }
.bg-slate-800\/80 { background-color: rgba(30, 41, 59, 0.8); }
.bg-slate-800\/90 { background-color: rgba(30, 41, 59, 0.9); }
.bg-blue-600 { background-color: #2563eb; }
.bg-pink-600 { background-color: #db2777; }
.bg-emerald-600 { background-color: #059669; }
.bg-emerald-500 { background-color: #10b981; }
.bg-emerald-950\/60 { background-color: rgba(6, 78, 59, 0.6); }
.bg-emerald-950\/70 { background-color: rgba(6, 78, 59, 0.7); }
.bg-rose-950\/50 { background-color: rgba(136, 19, 55, 0.5); }
.bg-rose-950\/60 { background-color: rgba(136, 19, 55, 0.6); }
.bg-amber-950\/60 { background-color: rgba(120, 53, 15, 0.6); }
.bg-amber-950\/70 { background-color: rgba(120, 53, 15, 0.7); }
.bg-amber-950\/80 { background-color: rgba(120, 53, 15, 0.8); }
.bg-yellow-950\/70 { background-color: rgba(113, 63, 18, 0.7); }
.bg-amber-400 { background-color: #fbbf24; }

.border { border-width: 1px; }
.border-t { border-top-width: 1px; }
.border-b { border-bottom-width: 1px; }
.border-slate-800 { border-color: #1e293b; }
.border-slate-700 { border-color: #334155; }
.border-emerald-500\/40 { border-color: rgba(16, 185, 129, 0.4); }
.border-emerald-500\/60 { border-color: rgba(16, 185, 129, 0.6); }
.border-rose-500\/40 { border-color: rgba(244, 63, 94, 0.4); }
.border-rose-500\/60 { border-color: rgba(244, 63, 94, 0.6); }
.border-amber-500\/50 { border-color: rgba(245, 158, 11, 0.5); }
.border-amber-500\/60 { border-color: rgba(245, 158, 11, 0.6); }
.border-yellow-400\/60 { border-color: rgba(250, 204, 21, 0.6); }

.text-white { color: #ffffff; }
.text-slate-100 { color: #f1f5f9; }
.text-slate-200 { color: #e2e8f0; }
.text-slate-300 { color: #cbd5e1; }
.text-slate-400 { color: #94a3b8; }
.text-emerald-400 { color: #34d399; }
.text-rose-300 { color: #fda4af; }
.text-amber-300 { color: #fde047; }
.text-sky-400 { color: #38bdf8; }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }

.uppercase { text-transform: uppercase; }
.tracking-wider { letter-spacing: 0.05em; }
.select-none { user-select: none; }
.shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
.shadow-md { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2); }

.w-full { width: 100%; }
.w-2 { width: 0.5rem; }
.h-2 { height: 0.5rem; }
.w-3\.5 { width: 0.875rem; }
.h-3\.5 { height: 0.875rem; }
.w-px { width: 1px; }
.h-4 { height: 1rem; }
.block { display: block; }
.inline-flex { display: inline-flex; }
.shrink-0 { flex-shrink: 0; }
.mx-0\.5 { margin-left: 0.125rem; margin-right: 0.125rem; }

button {
  cursor: pointer;
  border: 1px solid transparent;
  outline: none;
  font-family: inherit;
}

input, select {
  font-family: inherit;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}
