/* Çelik Birleşim — tek ortak program (utkucicek.com)
   css/taban-plakasi.css değişken ve sınıflarının (bp-*) üstüne; yeni sınıflar cb- önekli.
   Panel görünürlüğü body[data-adim] ile: basla | geometri | yukler | analiz | sonuclar | rapor */

:root { --cb-left-w: 300px; --cb-rail-w: 56px; --cb-right-w: 300px; --cb-bottom-h: 30vh;
  --cb-sel: #e0a400; --cb-done: var(--ok); --cb-soon: var(--bp-muted); }
:root[data-theme="dark"] { --cb-sel: #ffc94a; }

/* ---------------- iskelet ---------------- */
.cb-app { grid-template-rows: auto auto minmax(0, 1fr) auto; }
.cb-main { display: grid; min-height: 0; min-width: 0;
  grid-template-columns: var(--cb-left-w) var(--cb-rail-w) minmax(0, 1fr) var(--cb-right-w);
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas: "left rail view right" "bottom bottom bottom bottom"; }
.cb-main > * { min-width: 0; min-height: 0; }
.cb-left { grid-area: left; background: var(--bp-panel); border-right: 1px solid var(--bp-line); overflow: auto; }
.cb-rail { grid-area: rail; background: var(--bp-panel); border-right: 1px solid var(--bp-line); display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 0; overflow: auto; }
.cb-view { grid-area: view; position: relative; overflow: hidden; background: linear-gradient(var(--bp-sky1), var(--bp-sky2)); }
.cb-rapor { grid-area: view; display: none; }   /* rapor modülü (ui-sonuc.js) açıkken kendi tam ekran önizlemesini gösterir */
.cb-right { grid-area: right; background: var(--bp-panel); border-left: 1px solid var(--bp-line); overflow: auto; }
.cb-bottom { grid-area: bottom; background: var(--bp-panel); border-top: 1px solid var(--bp-line); max-height: var(--cb-bottom-h); overflow: auto; }
.cb-katalog, .cb-agac, .cb-ozellik { min-height: 0; }
.cb-sonuc, .cb-yukler { padding: 10px 14px 12px; }

/* yer tutucu (modül yüklenmediyse) */
.cb-bos { margin: 14px; padding: 12px 14px; border: 1px dashed var(--bp-line); border-radius: 10px; color: var(--bp-muted); font-size: 12.5px; background: var(--bp-bg2); }
.cb-bos b { display: block; color: var(--bp-fg); font-size: 13px; margin-bottom: 2px; }
.cb-view > .cb-bos { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; max-width: min(420px, calc(100% - 32px)); text-align: center; background: color-mix(in srgb, var(--bp-panel) 85%, transparent); }
.cb-sec-h { margin: 12px 14px 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--bp-muted); }

/* ---------------- üst çubuk ---------------- */
.cb-top { gap: 6px; }
.cb-top .cb-ad { flex: 1 1 80px; min-width: 60px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.cb-top .bp-tb { padding: 5px 8px; }
.cb-top .bp-run { flex: 0 0 auto; }
.cb-kod { display: flex; flex: 0 0 auto; margin-left: auto; border: 1px solid rgba(255,255,255,.3); border-radius: 8px; overflow: hidden; }
.cb-kod button { background: transparent; border: 0; border-left: 1px solid rgba(255,255,255,.25); color: #fff; padding: 5px 8px; cursor: pointer; white-space: nowrap; }
.cb-kod button:first-child { border-left: 0; }
.cb-kod button:hover { background: rgba(255,255,255,.14); }
.cb-kod button[aria-pressed="true"] { background: #fff; color: var(--bp-navy); font-weight: 600; }
.cb-rozet { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-weight: 700; font-size: 12.5px; white-space: nowrap; background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.25); cursor: default; }
.cb-rozet::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .8; }
.cb-rozet.ok { background: var(--ok); border-color: var(--ok); }
.cb-rozet.ng { background: var(--ng); border-color: var(--ng); }
.cb-rozet.warn, .cb-rozet.eski { background: var(--warn); border-color: var(--warn); color: #1b1300; }
.cb-rozet.eski { cursor: pointer; }
.cb-rozet.calisiyor::before { animation: cb-nabiz 1s infinite; }
@keyframes cb-nabiz { 50% { opacity: .2; } }

/* ---------------- adım şeridi ---------------- */
.cb-steps { display: flex; align-items: center; gap: 12px; padding: 6px 12px; background: var(--bp-panel); border-bottom: 1px solid var(--bp-line); overflow-x: auto; scrollbar-width: none; }
.cb-steps::-webkit-scrollbar { display: none; }
.cb-steps ol { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; flex: 0 0 auto; }
.cb-steps button { display: inline-flex; align-items: center; gap: 7px; border: 1px solid transparent; background: none; border-radius: 999px; padding: 4px 14px 4px 6px; cursor: pointer; color: var(--bp-muted); font: inherit; font-size: 13.5px; white-space: nowrap; }
.cb-steps button b { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--bp-bg); color: var(--bp-muted); font-size: 12px; }
.cb-steps button:hover { background: var(--bp-hover); color: var(--bp-fg); }
.cb-steps button.cb-done { color: var(--cb-done); font-weight: 600; }
.cb-steps button.cb-done b { background: color-mix(in srgb, var(--cb-done) 16%, transparent); color: var(--cb-done); }
.cb-steps button.cb-done b::after { content: "✓"; font-size: 10px; margin-left: 1px; }
.cb-steps button[aria-current="step"] { background: var(--bp-navy); color: #fff; font-weight: 600; }
.cb-steps button[aria-current="step"] b { background: rgba(255,255,255,.18); color: #fff; }
:root[data-theme="dark"] .cb-steps button[aria-current="step"] { background: var(--bp-acc); color: #0b1118; }
:root[data-theme="dark"] .cb-steps button[aria-current="step"] b { background: rgba(0,0,0,.18); color: #0b1118; }
.cb-steps-not { margin-left: auto; color: var(--bp-muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* ---------------- araç rayı ---------------- */
.cb-rail button { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 46px; padding: 6px 0 4px; border: 1px solid var(--bp-line); border-radius: 9px; background: var(--bp-panel); color: var(--bp-acc); cursor: pointer; font: inherit; font-size: 10.5px; line-height: 1.1; }
.cb-rail button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cb-rail button:hover { border-color: var(--bp-acc); background: var(--bp-hover); }
.cb-rail button.on { background: var(--bp-navy); border-color: var(--bp-navy); color: #fff; }
:root[data-theme="dark"] .cb-rail button.on { background: var(--bp-acc); border-color: var(--bp-acc); color: #0b1118; }
.cb-rail button[aria-disabled="true"] { color: var(--cb-soon); opacity: .55; cursor: not-allowed; }
.cb-rail button[aria-disabled="true"]:hover { border-color: var(--bp-line); background: var(--bp-panel); }

/* ---------------- adıma göre paneller ---------------- */
/* Başla: katalog solda (geniş), sağ panel ve alt panel gizli */
body[data-adim="basla"] { --cb-left-w: 360px; --cb-right-w: 0px; }
body[data-adim="basla"] .cb-right, body[data-adim="basla"] .cb-bottom { display: none; }
body:not([data-adim="basla"]) .cb-katalog { display: none; }
body[data-adim="basla"] .cb-agac { display: none; }
/* Yükler: alt panelde yük tablosu, kontroller gizli */
body:not([data-adim="yukler"]) .cb-yukler { display: none; }
body[data-adim="yukler"] .cb-sonuc { display: none; }
body[data-adim="yukler"] { --cb-bottom-h: 36vh; }
/* Sonuçlar: alt panel büyür */
body[data-adim="sonuclar"] { --cb-bottom-h: 42vh; }
body[data-adim="rapor"] .cb-rail { visibility: hidden; }

/* ---------------- bildirim ve yardım ---------------- */
.cb-toast.warn { background: #6b4a00; }
.cb-dlg kbd { margin-right: 2px; }
.cb-dlg ol { margin: 0; padding-left: 20px; } .cb-dlg li { margin: 0 0 6px; line-height: 1.5; }

/* ---------------- dar ekran ---------------- */
@media (max-width: 1280px) { :root { --cb-left-w: 270px; --cb-right-w: 270px; } body[data-adim="basla"] { --cb-left-w: 320px; } .cb-top .cb-ad { max-width: 150px; } .cb-top .bp-brand span { display: none; } }
@media (max-width: 1100px) { .cb-kod button { padding: 4px 6px; font-size: 12px; } .cb-steps-not { display: none; } }
@media (max-width: 960px) { .cb-top { flex-wrap: wrap; row-gap: 6px; } .cb-top .bp-run { margin-left: auto; } }
@media (max-width: 900px) {
  body.cb-body { overflow: auto; }
  .cb-app { height: auto; min-height: 100dvh; grid-template-rows: auto auto auto auto; }
  .cb-top .cb-kod { margin-left: 0; }
  .cb-steps button { padding: 4px 10px 4px 5px; font-size: 12.5px; }
  .cb-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: none;
    grid-template-areas: "rail" "view" "left" "right" "bottom"; }
  body[data-adim] .cb-main { grid-template-columns: minmax(0, 1fr); }
  .cb-rail { flex-direction: row; justify-content: flex-start; padding: 6px 8px; border-right: 0; border-bottom: 1px solid var(--bp-line); overflow-x: auto; }
  .cb-rail button { flex: 0 0 auto; }
  .cb-view { height: 58vh; min-height: 300px; }
  .cb-left { border-right: 0; border-bottom: 1px solid var(--bp-line); overflow: visible; }
  .cb-right { border-left: 0; border-bottom: 1px solid var(--bp-line); overflow: visible; }
  .cb-bottom { max-height: none; overflow: visible; }
  body[data-adim="basla"] .cb-main { grid-template-areas: "left" "rail" "view" "right" "bottom"; }
  body[data-adim="rapor"] .cb-rail { display: none; }
}
@media (max-width: 560px) { .cb-kod button { padding: 5px 6px; font-size: 11.5px; } .cb-steps button span { display: none; } .cb-steps button[aria-current="step"] span { display: inline; } }

/* ---------------- yazdırma ---------------- */
@media print {
  body.cb-printing { overflow: visible; background: #fff; color: #111; }
  body.cb-printing .cb-app > :not(.cb-main), body.cb-printing .bp-toast, body.cb-printing .bp-modal { display: none !important; }
  body.cb-printing .cb-main { display: block; }
  body.cb-printing .cb-main > :not(.cb-rapor) { display: none !important; }
  body.cb-printing .cb-rapor { display: block !important; padding: 0; background: #fff; overflow: visible; }
  body.cb-printing .cb-app { display: block; height: auto; }
}
@media (prefers-reduced-motion: reduce) { .cb-rozet.calisiyor::before { animation: none; } }
