/* FanSelect Studio - koyu hassas-enstruman temasi */
:root {
  --bg: #0b0f14;
  --surface: #11161d;
  --surface-2: #161d26;
  --surface-3: #1c2530;
  --border: #232c38;
  --border-hi: #2f3b4a;
  --text: #dce3ea;
  --muted: #8a97a6;
  --faint: #5c6875;
  --pressure: #38bdf8;      /* basinc / birincil aksan */
  --power: #fbbf24;         /* mil gucu */
  --ok: #34d399;            /* calisma noktasi / uygun */
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 10px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }
body {
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(56,189,248,.06), transparent 60%),
    radial-gradient(800px 400px at -10% 110%, rgba(52,211,153,.04), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  display: flex;
  flex-direction: column;
}

/* ---------- ust bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  color: var(--pressure);
  background: linear-gradient(145deg, rgba(56,189,248,.16), rgba(56,189,248,.04));
  border: 1px solid rgba(56,189,248,.3);
  box-shadow: 0 0 24px rgba(56,189,248,.15);
}
.brand h1 { font-size: 19px; font-weight: 650; letter-spacing: .2px; }
.brand h1 span { color: var(--pressure); font-weight: 350; }
.brand-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.topbar-meta {
  display: flex; gap: 18px; align-items: center; font-size: 12px; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.lang-switch { display: flex; gap: 2px; border: 1px solid var(--border); border-radius: 7px; padding: 2px; }
.lang-btn {
  border: none; background: transparent; color: var(--muted);
  font: 600 11px var(--font); letter-spacing: .03em;
  padding: 4px 9px; border-radius: 5px; cursor: pointer;
  transition: background .15s, color .15s;
}
.lang-btn:hover { color: var(--text); }
.lang-btn.on { background: var(--accent, #38bdf8); color: #0b1420; }

/* ---------- yerlesim ---------- */
.layout {
  flex: 1; display: grid;
  grid-template-columns: 285px 1fr;
  gap: 16px; padding: 16px 22px 22px;
  align-items: start;
  max-width: 1680px; width: 100%; margin: 0 auto;
}
.content { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.panel-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .12em; color: var(--faint); margin-bottom: 12px;
}
.side { position: sticky; top: 16px; }
.side .panel-title:not(:first-child) { margin-top: 22px; }

/* ---------- mod sekmeleri ---------- */
.mode-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  padding: 4px; margin-bottom: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 9px;
}
.mode-tab {
  padding: 8px 0; border: none; border-radius: 6px; cursor: pointer;
  font: 600 12.5px var(--font); color: var(--muted);
  background: transparent;
  transition: all .15s;
}
.mode-tab:hover { color: var(--text); }
.mode-tab.on {
  color: #06202e; background: var(--pressure);
  box-shadow: 0 2px 10px rgba(56,189,248,.25);
}

.catalog-hint {
  margin-top: 9px; font-size: 11.5px; color: var(--faint);
  line-height: 1.45;
}
#chart.catalog { cursor: crosshair; }

/* ---------- form ---------- */
.field { display: block; margin-bottom: 12px; }
.field span {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; color: var(--muted); margin-bottom: 5px;
}
.field em { font-style: normal; color: var(--faint); font-size: 11px; }
.field input {
  width: 100%; padding: 9px 11px;
  background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 7px;
  color: var(--text); font: 600 15px var(--font);
  font-variant-numeric: tabular-nums;
  transition: border-color .15s, box-shadow .15s;
}
.field input:hover { border-color: var(--border-hi); }
.field input:focus {
  outline: none; border-color: var(--pressure);
  box-shadow: 0 0 0 3px rgba(56,189,248,.15);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.series-select {
  width: 100%; padding: 9px 11px;
  background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 7px;
  color: var(--text); font: 600 14px var(--font);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.series-select:hover { border-color: var(--border-hi); }
.series-select:focus {
  outline: none; border-color: var(--pressure);
  box-shadow: 0 0 0 3px rgba(56,189,248,.15);
}
.series-select option { background: var(--surface-2); color: var(--text); }

.rho-out {
  display: block; padding: 9px 11px;
  background: var(--surface-3);
  border: 1px dashed var(--border); border-radius: 7px;
  color: var(--muted); font: 600 15px var(--font);
  font-variant-numeric: tabular-nums;
}

.btn-primary {
  width: 100%; margin-top: 18px; padding: 12px;
  border: none; border-radius: 8px; cursor: pointer;
  font: 650 14px var(--font); letter-spacing: .03em;
  color: #06202e;
  background: linear-gradient(180deg, #4cc7fa, #2ba8e0);
  box-shadow: 0 4px 18px rgba(56,189,248,.25);
  transition: filter .15s, transform .1s;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:active { transform: translateY(1px); }
.form-error { margin-top: 10px; font-size: 12.5px; color: var(--bad); }

/* ---------- coklu calisma noktasi + LCC ---------- */
.mop { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.mop summary {
  cursor: pointer; font: 600 12px var(--font); color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em; list-style-position: inside;
}
.mop summary:hover { color: var(--text); }
.mop[open] summary { margin-bottom: 8px; }
.mop-row {
  display: grid; grid-template-columns: 1fr 1fr 1fr 26px; gap: 6px;
  margin-bottom: 8px; align-items: center;
}
.mop-row input {
  width: 100%; min-width: 0; padding: 7px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 7px;
  color: var(--text); font: 600 13px var(--font);
  font-variant-numeric: tabular-nums;
}
.mop-row input:focus {
  outline: none; border-color: var(--pressure);
  box-shadow: 0 0 0 3px rgba(56,189,248,.15);
}
.mop-del {
  height: 28px; border-radius: 7px; cursor: pointer;
  background: transparent; border: 1px solid var(--border);
  color: var(--faint); font: 600 14px var(--font); line-height: 1;
}
.mop-del:hover { color: var(--bad); border-color: var(--bad); }
.mop-add { width: 100%; margin: 2px 0 12px; }
.mop-auto {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  font: 600 12px var(--font); color: var(--text); margin-bottom: 6px;
}
.mop-auto input { accent-color: var(--ok); width: 15px; height: 15px; }
.mop-main-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 10px; padding: 7px 10px;
  background: rgba(52,211,153,.09); border: 1px solid rgba(52,211,153,.3); border-radius: 7px;
}
.mop-main-label { font: 600 12px var(--font); color: var(--text); }
.mop-main-hours { display: flex; align-items: center; gap: 6px; }
.mop-main-hours input {
  width: 76px; padding: 6px 8px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 7px; color: var(--text);
  font: 600 13px var(--font); font-variant-numeric: tabular-nums; text-align: right;
}
.mop-main-hours em { font-size: 11px; color: var(--faint); font-style: normal; }
.mop-table .mop-bad td { color: var(--bad); }
.mop-table td:last-child { color: var(--text); }

.btn-ghost {
  padding: 9px 16px; border-radius: 8px; cursor: pointer;
  font: 600 13px var(--font); color: var(--pressure);
  background: transparent; border: 1px solid rgba(56,189,248,.4);
  transition: all .15s;
}
.btn-ghost:hover { background: rgba(56,189,248,.1); }

/* ---------- gosterge ---------- */
.legend { margin-top: 22px; }
.lg { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--muted); margin-bottom: 7px; }
.sw { width: 20px; height: 3px; border-radius: 2px; flex: none; }
.sw-pressure { background: var(--pressure); }
.sw-power { background: var(--power); }
.sw-eff { background: #a78bfa; }
.sw-system { background: repeating-linear-gradient(90deg, var(--muted) 0 4px, transparent 4px 8px); }
.sw-duty { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); }
.sw-env { height: 10px; background: rgba(56,189,248,.12); border: 1px solid rgba(56,189,248,.25); }

/* ---------- sonuc tablosu ---------- */
.results-head { display: flex; align-items: center; justify-content: space-between; }
.count-badge {
  font-size: 12px; color: var(--ok); font-variant-numeric: tabular-nums;
  padding: 3px 10px; border-radius: 999px;
  background: rgba(52,211,153,.1); border: 1px solid rgba(52,211,153,.25);
}
.count-badge:empty { display: none; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th {
  text-align: left; font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em; color: var(--faint);
  padding: 8px 10px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
th em { font-style: normal; text-transform: none; letter-spacing: 0; color: var(--faint); }
th.num, td.num { text-align: right; }
th.sortable { cursor: pointer; }
th.sortable:hover { color: var(--text); }
th.sorted-asc::after { content: " ▲"; color: var(--pressure); }
th.sorted-desc::after { content: " ▼"; color: var(--pressure); }
td {
  padding: 9px 10px; font-size: 13.5px;
  border-bottom: 1px solid rgba(35,44,56,.55);
  white-space: nowrap;
}
tbody tr { cursor: pointer; transition: background .12s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr.sel { background: rgba(56,189,248,.08); box-shadow: inset 3px 0 0 var(--pressure); }
td.model { font-weight: 650; }
td.model small { display: block; font-weight: 400; font-size: 11px; color: var(--faint); }
.effbar {
  display: inline-block; vertical-align: middle; margin-left: 8px;
  width: 52px; height: 4px; border-radius: 2px; background: var(--surface-3);
  overflow: hidden;
}
.effbar i { display: block; height: 100%; background: linear-gradient(90deg, #2ba8e0, var(--ok)); }
.empty-msg { padding: 26px 10px; color: var(--faint); font-size: 13.5px; text-align: center; }
.flow-flag { color: var(--warn); font-size: 11px; margin-left: 6px; cursor: help; }
th.chk, td.chk { text-align: center; width: 34px; }
td.chk input {
  width: 15px; height: 15px; cursor: pointer;
  accent-color: var(--pressure);
}

/* ---------- karsilastirma ---------- */
.compare-box { min-height: 440px; margin-bottom: 14px; }
.compare-box canvas { width: 100%; height: 440px; display: block; }
.compare-table td:first-child { color: var(--muted); white-space: nowrap; }
.compare-table th { font-size: 12px; text-transform: none; letter-spacing: .02em; color: var(--text); }
.cmp-sw {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 3px; margin-right: 7px; vertical-align: middle;
}

/* ---------- detay ---------- */
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.detail-head h2 { font-size: 21px; font-weight: 700; letter-spacing: .3px; }
.badges { display: flex; gap: 7px; margin-top: 7px; flex-wrap: wrap; }
.badge {
  font-size: 11px; padding: 3px 9px; border-radius: 999px;
  color: var(--muted); background: var(--surface-2); border: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.badge.ok { color: var(--ok); border-color: rgba(52,211,153,.3); background: rgba(52,211,153,.08); }
.badge.warn { color: var(--warn); border-color: rgba(251,191,36,.3); background: rgba(251,191,36,.08); }

.angle-hint {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 13px 16px;
  font-size: 13.5px; line-height: 1.5; color: var(--warn);
  background: rgba(251,191,36,.1);
  border: 1px solid rgba(251,191,36,.45); border-radius: 8px;
}
.angle-hint[hidden] { display: none; }
.angle-hint b { color: var(--text); }
.btn-ghost.btn-sm {
  padding: 10px 18px; font-size: 13px; font-weight: 600; white-space: nowrap; flex: none;
  color: #1a1a1a; background: var(--warn); border-color: var(--warn); border-radius: 8px;
}
.btn-ghost.btn-sm:hover { background: rgba(251,191,36,.85); }

.chart-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; }
.chart-box {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px; height: 560px;
  display: flex;
}
.chart-box canvas { width: 100%; height: 100%; display: block; }

.stat-col { display: flex; flex-direction: column; gap: 10px; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px;
}
.stat b {
  display: block; font-size: 17px; font-weight: 700;
  font-variant-numeric: tabular-nums; letter-spacing: .2px;
}
.stat b small { font-size: 11px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.stat span { font-size: 10.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .07em; }
.stat.hero { grid-column: span 2; border-color: rgba(52,211,153,.3); background: rgba(52,211,153,.06); }
.stat.hero b { color: var(--ok); font-size: 21px; }

.motor-card {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 13px 14px;
}
.motor-card h3 {
  font-size: 10.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .1em; color: var(--faint); margin-bottom: 9px;
}
.motor-card .mc-main { font-size: 16px; font-weight: 700; margin-bottom: 3px; }
.motor-card .mc-main small { font-weight: 500; color: var(--muted); font-size: 12px; }
.motor-rows { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 14px; margin-top: 8px; }
.motor-rows div { display: flex; justify-content: space-between; font-size: 12px; padding: 2px 0; }
.motor-rows dt { color: var(--faint); }
.motor-rows dd { font-variant-numeric: tabular-nums; }
.motor-none { color: var(--bad); font-size: 13px; }

.energy-section {
  margin-top: 16px; background: var(--surface-2);
  border: 1px solid rgba(52,211,153,.35); border-top: 3px solid var(--ok);
  border-radius: 10px; padding: 20px 24px;
}
.energy-section h3 {
  font-size: 14px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text); margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.energy-section h3::before { content: "⚡"; font-size: 15px; }
.energy-section .table-wrap { margin-bottom: 16px; }
.energy-section .oct-table.mop-table { font-size: 13px; }
.energy-section .oct-table.mop-table th,
.energy-section .oct-table.mop-table td { padding: 6px 10px; }
.energy-section .motor-rows {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px 22px; margin-top: 4px;
}
.energy-section .motor-rows div {
  flex-direction: column; align-items: flex-start; gap: 2px; padding: 4px 0;
}
.energy-section .motor-rows dt { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.energy-section .motor-rows dd { font-size: 17px; font-weight: 700; color: var(--ok); }
.energy-section .card-note { margin-top: 14px; font-size: 11.5px; color: var(--faint); }
.energy-section .motor-none { font-size: 13px; }

.oct-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.oct-table th, .oct-table td {
  padding: 3px 4px; text-align: right; border-bottom: 1px solid rgba(35,44,56,.55);
  white-space: nowrap;
}
.oct-table th { color: var(--faint); font-weight: 600; text-transform: none; letter-spacing: 0; }
.oct-table td:first-child, .oct-table th:first-child { text-align: left; color: var(--muted); }
.oct-table td:last-child { color: var(--ok); }

/* ---------- yazdirma bolum secimi ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4,8,12,.6); backdrop-filter: blur(2px);
}
.modal-backdrop[hidden] { display: none; }
.modal {
  width: 320px; padding: 20px;
  background: var(--surface-2); border: 1px solid var(--border-hi);
  border-radius: 12px; box-shadow: 0 18px 50px rgba(0,0,0,.5);
}
.modal h3 {
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .1em; color: var(--faint); margin-bottom: 13px;
}
.modal-opt {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 2px; font-size: 13.5px; cursor: pointer;
  border-bottom: 1px solid rgba(35,44,56,.5);
}
.modal-opt:hover { color: var(--pressure); }
.modal-opt input { width: 15px; height: 15px; accent-color: var(--pressure); cursor: pointer; }
.modal-actions { display: flex; gap: 9px; justify-content: flex-end; margin-top: 16px; }
.btn-primary.btn-inline { width: auto; margin-top: 0; padding: 9px 18px; }

/* ---------- yazdirma ---------- */
.print-only { display: none; }

@media print {
  @page {
    size: A4 portrait; margin: 12mm 13mm;
    /* sadece sayfa numarasi; tarayicinin kendi ust/alt bilgisini yazdirma
       penceresinden kapatin (Chrome: Ustbilgi ve altbilgiler isaretini kaldir) */
    @bottom-center { content: counter(page); font-size: 9px; color: #94a3b8; }
  }
  body { background: #fff; color: #0f172a; display: block; }
  .no-print { display: none !important; }
  .print-only { display: block; }
  #report { padding: 0; font-size: 11px; }
  .rp-head {
    display: flex; justify-content: space-between; align-items: flex-end;
    border-bottom: 2.5px solid #0284c7; padding-bottom: 6px; margin-bottom: 8px;
  }
  .rp-head h1 { font-size: 19px; color: #0284c7; letter-spacing: .04em; }
  .rp-sub, #rpDate { color: #64748b; font-size: 10px; }
  .rp-model { font-size: 14px; margin-bottom: 6px; color: #0f172a; }
  .rp-chart { border: 1px solid #e2e8f0; border-radius: 6px; padding: 4px; margin-bottom: 8px; }
  .rp-chart canvas { width: 100%; height: auto; }
  .rp-tables { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .rp-tables table { width: 100%; border-collapse: collapse; break-inside: avoid; }
  .rp-tables caption {
    text-align: left; font-weight: 700; font-size: 10px; color: #fff;
    background: #0284c7; padding: 4px 8px; letter-spacing: .05em;
  }
  .rp-tables table.motor caption { background: #059669; }
  .rp-tables table.energy caption { background: #b45309; }
  .rp-tables table.acoustic { grid-column: 1 / -1; }
  .rp-tables table.acoustic caption { background: #7c3aed; }
  .rp-tables table.acoustic td { text-align: right; width: auto; }
  .rp-tables table.acoustic td:first-child { text-align: left; }
  .rp-tables td {
    border: 1px solid #e2e8f0; padding: 3px 7px; font-size: 10px;
    white-space: normal;
  }
  .rp-tables td:first-child { color: #475569; width: 46%; }
  .rp-tables td:last-child { font-weight: 600; font-variant-numeric: tabular-nums; }
}

/* ---------- dar ekran ---------- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; }
  .detail-grid { grid-template-columns: 1fr; }
}
