/* =========================================
   TORQUECURVE — style.css
   Torque to Horsepower Converter
   Design system: white cards, #061d33 text,
   #ff9901 accent — DM Sans + IBM Plex Mono
   ========================================= */

:root {
  --primary:        #ff9901;
  --primary-hover:  #e68a00;
  --primary-light:  #fff7e6;
  --dark:           #061d33;
  --mid:            #4a5568;
  --muted:          #9ca3af;
  --border:         #e2e8f0;
  --bg:             #f7f8fa;
  --white:          #ffffff;
  --radius:         10px;
  --radius-sm:      6px;
  --shadow:         0 4px 10px rgba(0,0,0,0.08);
  --shadow-md:      0 8px 24px rgba(0,0,0,0.12);
  --font-body:      'DM Sans', sans-serif;
  --font-mono:      'IBM Plex Mono', monospace;
}

/* ---- APP WRAPPER ---- */
.torquecurve-app {
  width: 100%;
  margin-bottom: 40px;
}

.torquecurve-app .app-container.torquecurve-container {
  max-width: 100%;
  padding: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: visible;
}

/* ---- INPUT BAR ---- */
.tc-input-bar {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  display: flex;
  gap: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.tc-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 140px;
}

.tc-field label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  color: var(--dark);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tc-req { color: var(--primary); }

.tc-input-wrap {
  display: flex;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1.5px solid #d1d5db;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.tc-input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255,153,1,0.15);
}

.tc-input-wrap .tc-input {
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.tc-input-wrap .tc-input:focus {
  box-shadow: none;
}

.tc-unit-select {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--mid);
  background: var(--bg);
  border: none;
  border-left: 1px solid #d1d5db;
  padding: 0 10px;
  cursor: pointer;
  outline: none;
  appearance: none;
  min-width: 85px;
  text-align: center;
  background-image: url('data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2210%22 height=%2210%22 viewBox=%220 0 12 12%22%3E%3Cpath fill=%22%239ca3af%22 d=%22M2 4l4 4 4-4z%22/%3E%3C/svg%3E');
  background-repeat: no-repeat;
  background-position: right 6px center;
  padding-right: 20px;
}

.tc-input {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--dark);
  background: var(--white);
  border: 1.5px solid #d1d5db;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  outline: none;
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
  -moz-appearance: textfield;
}

.tc-input::-webkit-outer-spin-button,
.tc-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.tc-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255,153,1,0.15);
}

/* Direction toggle */
.tc-dir-btns {
  display: flex;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1.5px solid #d1d5db;
}

.tc-dir-btn {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  padding: 10px 12px;
  border: none;
  background: var(--white);
  color: var(--mid);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.tc-dir-btn + .tc-dir-btn {
  border-left: 1px solid #d1d5db;
}

.tc-dir-btn.active {
  background: var(--primary);
  color: var(--white);
}

/* ---- RESULTS ---- */
.tc-results {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.tc-empty {
  text-align: center;
  padding: 20px 0;
}

.tc-empty p {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--muted);
}

/* Result cards */
.tc-result-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  animation: tc-fadeIn 0.25s ease;
}

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

.tc-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 14px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
}

.tc-card-primary {
  background: var(--primary-light);
  border-color: var(--primary);
}

.tc-card-label {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tc-card-primary .tc-card-label { color: var(--primary-hover); }

.tc-card-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--dark);
  line-height: 1.1;
}

.tc-card-unit {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--mid);
  font-weight: 500;
}

/* Formula */
.tc-formula {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  padding: 10px 0 0;
  line-height: 1.5;
}

/* ---- CHART ---- */
.tc-chart-wrap {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tc-chart-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--dark);
  font-weight: 500;
}

.tc-chart-header strong {
  color: var(--primary);
  font-family: var(--font-mono);
  font-weight: 700;
}

.tc-chart-container {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.tc-chart-container canvas {
  width: 100%;
  height: auto;
  display: block;
}

.tc-chart-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: center;
}

.tc-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--mid);
}

.tc-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tc-dot-hp { background: var(--primary); }
.tc-dot-mark { background: var(--dark); }

.tc-chart-note {
  font-family: var(--font-body);
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

/* ---- TOAST ---- */
.of-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--dark);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 4000;
  white-space: nowrap;
}

.of-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---- RESPONSIVE ---- */
@media (max-width: 640px) {
  .tc-input-bar { flex-direction: column; gap: 10px; }
  .tc-field { min-width: 100%; }
  .tc-result-cards { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 380px) {
  .tc-result-cards { grid-template-columns: 1fr; }
  .tc-card-value { font-size: 20px; }
}