/* ================================================================
   CAR Calculator – Light Theme Styles
   ================================================================ */

.car-calculator-wrap *,
.car-calculator-wrap *::before,
.car-calculator-wrap *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.car-calculator-wrap {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: #1e293b;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 600px;
}

.car-calc-loading {
  padding: 20px;
  color: #64748b;
}

/* ── Layout ─────────────────────────────────────────────────────── */
.car-calc-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* ── Left Panel ──────────────────────────────────────────────────── */
.car-calc-left {
  width: 340px;
  min-width: 280px;
  background: #f1f5f9;
  border-right: 1px solid #e2e8f0;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ── Right Panel ─────────────────────────────────────────────────── */
.car-calc-right {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: #f8fafc;
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.car-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
  text-decoration: none;
  border: 1px solid transparent;
}

.car-btn-outline {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #334155;
}
.car-btn-outline:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.car-btn-green {
  background: #059669;
  color: #ffffff;
  border-color: #047857;
}
.car-btn-green:hover {
  background: #047857;
}
.car-btn-green:disabled,
.car-btn-green[disabled] {
  background: #a7f3d0;
  border-color: #a7f3d0;
  cursor: not-allowed;
  color: #ffffff;
}

.car-btn-primary {
  background: #0d9488;
  color: #ffffff;
  border-color: #0f766e;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 13px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.car-btn-primary:hover {
  background: #0f766e;
}

.car-btn-ghost {
  background: transparent;
  color: #64748b;
  border-color: transparent;
  font-size: 12px;
}
.car-btn-ghost:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.car-btn-row {
  display: flex;
  gap: 8px;
}
.car-btn-row .car-btn {
  flex: 1;
}
.car-btn-full {
  width: 100%;
}

/* ── CSV Format hint ─────────────────────────────────────────────── */
.car-format-hint {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 10px 12px;
  font-family: "Courier New", Courier, monospace;
  font-size: 11px;
  color: #475569;
  line-height: 1.7;
}
.car-format-hint strong {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: #334155;
  display: block;
  margin-bottom: 4px;
}
.car-format-hint em {
  font-style: italic;
  font-size: 10px;
  color: #94a3b8;
  display: block;
  margin-top: 4px;
}

/* ── Form elements ───────────────────────────────────────────────── */
.car-form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.car-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #64748b;
}

.car-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #64748b;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 4px;
}

.car-input,
.car-select,
.car-textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #1e293b;
  font-size: 12px;
  font-family: "Courier New", Courier, monospace;
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
.car-input:focus,
.car-select:focus,
.car-textarea:focus {
  border-color: #0d9488;
  box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.15);
}

.car-textarea {
  height: 140px;
  resize: vertical;
  line-height: 1.6;
  font-size: 11px;
}

.car-select {
  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='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  padding-right: 30px;
  cursor: pointer;
}

.car-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ── Error ───────────────────────────────────────────────────────── */
.car-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  padding: 8px 12px;
  color: #dc2626;
  font-size: 12px;
  display: flex;
  align-items: flex-start;
  gap: 7px;
  line-height: 1.5;
}
.car-error svg {
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── Summary cards ───────────────────────────────────────────────── */
.car-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

@media (max-width: 900px) {
  .car-cards { grid-template-columns: repeat(2, 1fr); }
  .car-calc-body { flex-direction: column; }
  .car-calc-left { width: 100%; border-right: none; border-bottom: 1px solid #e2e8f0; }
}
@media (max-width: 500px) {
  .car-cards { grid-template-columns: 1fr 1fr; }
}

.car-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.car-card-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #64748b;
  margin-bottom: 6px;
}
.car-card-value {
  font-size: 26px;
  font-weight: 700;
  font-family: "Courier New", Courier, monospace;
  color: #1e293b;
  line-height: 1.1;
}
.car-card-value.positive { color: #059669; }
.car-card-value.negative { color: #dc2626; }
.car-card-unit {
  font-size: 13px;
  font-weight: 400;
  color: #94a3b8;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin-left: 2px;
}

/* ── Panel section ───────────────────────────────────────────────── */
.car-panel {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.car-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}
.car-panel-title {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
}
.car-panel-body {
  padding: 16px;
}

/* ── Chart ───────────────────────────────────────────────────────── */
.car-chart-wrap {
  position: relative;
  height: 320px;
  width: 100%;
}

/* ── Table ───────────────────────────────────────────────────────── */
.car-table-scroll {
  overflow-x: auto;
  max-height: 420px;
  overflow-y: auto;
}

.car-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-family: "Courier New", Courier, monospace;
}
.car-table thead th {
  position: sticky;
  top: 0;
  background: #f1f5f9;
  padding: 8px 12px;
  text-align: right;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  z-index: 2;
}
.car-table thead th:first-child,
.car-table thead th:nth-child(2) {
  text-align: left;
}
.car-table tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.1s;
}
.car-table tbody tr:hover {
  background: #f8fafc;
}
.car-table tbody tr.event-row {
  background: #f0fdfa;
}
.car-table tbody tr.event-row:hover {
  background: #ccfbf1;
}
.car-table td {
  padding: 7px 12px;
  text-align: right;
  color: #334155;
  white-space: nowrap;
}
.car-table td:first-child {
  text-align: left;
}
.car-table td:nth-child(2) {
  text-align: left;
  color: #64748b;
}
.car-table td.positive { color: #059669; }
.car-table td.negative { color: #dc2626; }
.car-table td.running-car { font-weight: 600; color: #1e293b; }

/* ── Empty state ─────────────────────────────────────────────────── */
.car-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  border: 2px dashed #e2e8f0;
  border-radius: 10px;
  color: #94a3b8;
  text-align: center;
}
.car-empty svg {
  margin-bottom: 16px;
  opacity: 0.4;
}
.car-empty-title {
  font-size: 16px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 6px;
}
.car-empty-desc {
  font-size: 13px;
  max-width: 300px;
  line-height: 1.5;
}
