/* İŞ 134 / bölüm 6: Belge Oku ekranı (giriş görünümü, canlı okuma, kart sonuç, sabit "Stoğa işle" çubuğu).
   mobil.css'ten SONRA yüklenir. Eski ve yeni tasarım (html.yt) ortak çalışır; renkler --pri (yeni) yoksa --accent/--primary (eski)'a düşer. */

.bo { --bo-main: var(--pri-btn, var(--accent, #b54708)); --bo-main-dark: var(--pri-dark, var(--accent-dark, #93370d)); --bo-main-soft: var(--pri-soft, var(--accent-soft, #fffaeb));
  --bo-hardal: #c58a12; --bo-hardal-soft: #fbf0d9; --bo-blue: var(--accent-blue, #2b6cb0); --bo-blue-soft: var(--accent-blue-soft, #e3edf8); }
.bo [hidden], .bo-reading[hidden], .bo-preview[hidden] { display: none !important; }
.bo-hidden-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }

/* yol göstergesi */
.bo-steps { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px; font-size: .92rem; color: var(--muted, #667085); }
.bo-steps li { display: inline-flex; align-items: center; gap: 5px; }
.bo-steps li.on { color: var(--bo-main-dark); font-weight: 700; }
.bo-steps li.done { color: #1f7a4d; font-weight: 600; }
.bo-steps li.done b { color: #1f9d55; }

/* Z raporu çok sayfalı çekim: çekilen sayfaların küçük görselleri */
.zr-multi { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.zr-page { margin: 0; width: 64px; text-align: center; font-size: .72rem; color: var(--muted, #667085); }
.zr-page img { display: block; width: 64px; height: 84px; object-fit: cover; border-radius: 8px; border: 2px solid var(--border, #d0d5dd); background: #fff; }
.zr-page.reading img { border-color: var(--bo-main, #1f9d55); animation: zr-pulse 1s ease-in-out infinite; }
.zr-page.done img { border-color: #1f9d55; }
.zr-page.fail img { border-color: #b3261e; }
.zr-state::after { margin-left: 4px; font-style: normal; font-weight: 700; }
.zr-page.done .zr-state::after { content: "✓"; color: #1f9d55; }
.zr-page.fail .zr-state::after { content: "!"; color: #b3261e; }
@keyframes zr-pulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .zr-page.reading img { animation: none; } }
.field-warn { outline: 2px solid #b3261e; outline-offset: 1px; }
.bo-steps .bo-arrow { color: var(--muted-soft, #98a2b3); }

/* büyük orta alan */
.bo-drop { position: relative; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
  padding: 28px 16px 22px; border: 2px dashed var(--border-strong, #d0d5dd); border-radius: 20px; background: var(--surface-alt, #f7f8fa);
  transition: border-color .15s ease, background .15s ease, transform .15s ease; }
.bo-drop.bo-over { border-color: var(--bo-main); border-style: solid; background: var(--bo-main-soft); transform: scale(1.01); box-shadow: 0 0 0 4px color-mix(in srgb, var(--bo-main) 22%, transparent); }
.bo-drop-icon { display: inline-flex; width: 72px; height: 72px; align-items: center; justify-content: center; border-radius: 50%; background: var(--bo-main-soft); color: var(--bo-main); }
.bo-drop-icon svg { width: 38px; height: 38px; }
.bo-drop.has-file .bo-drop-icon, .bo-drop.has-file .bo-camera-btn, .bo-drop.has-file .bo-file-btn, .bo-drop.has-file .bo-drop-hint { display: none; }
.bo-camera-btn, .bo-file-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; width: 100%; max-width: 420px; padding: 12px 20px;
  border-radius: 14px; font-size: 1.05rem; font-weight: 700; cursor: pointer; font-family: inherit; }
.bo-camera-btn { background: var(--bo-main); color: #fff; border: 0; box-shadow: 0 8px 18px -10px var(--bo-main); }
.bo-camera-btn:hover:not(:disabled) { background: var(--bo-main-dark); }
.bo-file-btn { min-height: 46px; font-size: .95rem; font-weight: 600; background: var(--surface, #fff); color: var(--text, inherit); border: 1px solid var(--border-strong, #d0d5dd); }
.bo-camera-btn:disabled, .bo-file-btn:disabled { opacity: .5; cursor: not-allowed; }
.bo-camera-btn svg, .bo-file-btn svg { width: 22px; height: 22px; flex: 0 0 auto; }
.bo-drop-hint { display: none; margin: 2px 0 0; color: var(--muted, #667085); font-size: .9rem; }
@media (hover: hover) and (pointer: fine) { .bo-drop-hint { display: block; } .bo-drop-icon { width: 64px; height: 64px; } }

/* seçilen fotoğraf önizlemesi */
.bo-preview { display: flex; gap: 14px; align-items: center; width: 100%; text-align: left; }
.bo-preview img { width: 96px; height: 96px; object-fit: cover; border-radius: 12px; border: 1px solid var(--border, #e4e7ec); background: #fff; flex: 0 0 auto; }
.bo-preview-side { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 10px; }
.bo-preview-side strong { overflow-wrap: anywhere; font-size: .95rem; }
.bo-preview-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.bo-read-btn { min-height: 48px; min-width: 120px; font-size: 1.05rem; background: var(--bo-main); color: #fff; }

.bo-kind { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 14px 0 0; font-size: .9rem; color: var(--muted, #667085); }
.bo-kind select { min-height: 44px; font-size: 16px; }
.bo-tip { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 8px; margin: 14px 0 0; padding: 10px 12px; border-radius: 12px;
  background: var(--bo-hardal-soft); color: #6b4a08; font-size: .88rem; }
.bo-tip svg { width: 18px; height: 18px; vertical-align: middle; }
.bo-tip > span:last-child { flex: 1 1 200px; text-align: center; }
.bo-usage { text-align: center; margin: 10px 0 0; font-size: .82rem; }
.bo-xml-not { text-align: center; margin: 10px 0 0; font-size: .82rem; } /* İŞ 349: ayrı e-Fatura bölümünün bilgisi */

/* okunurken */
.bo-reading { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 12px 0 6px; }
.bo-scan { position: relative; width: 168px; height: 210px; border-radius: 14px; overflow: hidden; background: var(--surface-alt, #f2f4f7); border: 1px solid var(--border-strong, #d0d5dd); display: flex; align-items: center; justify-content: center; }
.bo-scan img { width: 100%; height: 100%; object-fit: cover; }
.bo-scanline { position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--bo-main); box-shadow: 0 0 14px 4px color-mix(in srgb, var(--bo-main) 55%, transparent); animation: bo-scan 1.8s ease-in-out infinite alternate; }
@keyframes bo-scan { from { top: 0; } to { top: calc(100% - 3px); } }
.bo-reading-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 1rem; }
.bo-reading-steps li { color: var(--muted-soft, #98a2b3); }
.bo-reading-steps li.done { color: var(--ok-dark, #055c37); }
.bo-reading-steps li.done::before { content: "✓ "; }
.bo-reading-steps li.now { color: var(--text, #1f1a17); font-weight: 700; }
.bo-reading-steps li.now::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 6px; border-radius: 50%; background: var(--bo-main); animation: bo-pulse 1s ease-in-out infinite; }
@keyframes bo-pulse { 50% { opacity: .25; } }
@keyframes bo-glow { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
.bo-slow { margin: 0; padding: 8px 12px; border-radius: 10px; background: var(--bo-hardal-soft); color: #6b4a08; font-size: .9rem; text-align: center; }
@media (prefers-reduced-motion: reduce) {
  /* İŞ 192: hareket azaltma açıkken çizgi donuk kalmasın; konum sabit, yalnız yumuşak parlama (canlı olduğu belli olsun) */
  .bo-scanline { animation: bo-glow 1.6s ease-in-out infinite; top: 50%; }
  .bo-reading-steps li.now::after { animation: none; }
  .bo-drop { transition: none; }
}

/* sonuç */
.bo-result-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.bo-tag { display: inline-flex; align-items: center; gap: 4px; margin: 0 6px 0 0; padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.bo-tag svg { width: 13px; height: 13px; }
.bo-tag.ok { background: var(--ok-soft, #ecfdf3); color: var(--ok-dark, #055c37); }
.bo-tag.new { background: var(--bo-blue-soft); color: var(--bo-blue); }
.bo-needs-check .ocr-qty-input, .bo-needs-check .ocr-price-input, #ocr-result .vat-note.vat-defaulted { border: 2px solid var(--bo-hardal); border-radius: 8px; background: var(--bo-hardal-soft); }
.bo-needs-check .ocr-qty-input, .bo-needs-check .ocr-price-input { font-size: 16px; min-height: 44px; }

/* sabit alt çubuk */
.bo-bar { position: sticky; bottom: 0; z-index: 20; margin: 14px -4px 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); background: var(--surface, #fff); border-top: 1px solid var(--border, #e4e7ec); box-shadow: 0 -8px 20px -14px rgba(0, 0, 0, .35); }
.bo-bar-msg { display: block; min-height: 0; margin-bottom: 4px; font-size: .88rem; }
.bo-bar-msg:empty { display: none; }
.bo-bar-row { display: flex; align-items: center; gap: 12px; }
.bo-bar-sum { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.bo-bar-sum span { font-size: .78rem; color: var(--muted, #667085); }
.bo-bar-sum strong { font-size: 1.15rem; white-space: nowrap; }
.bo-bar-btn { margin-left: auto; min-height: 52px; padding: 12px 26px; font-size: 1.1rem; font-weight: 700; border-radius: 14px; background: var(--bo-main); color: #fff; }
.bo-bar-btn:disabled { opacity: .55; }

.bo-einv { margin-top: 22px; padding-top: 12px; border-top: 1px solid var(--border, #e4e7ec); }
.bo-einv summary { cursor: pointer; font-weight: 600; font-size: .92rem; min-height: 44px; display: flex; align-items: center; }

/* son belgeler */
.bo-recent { margin-top: 18px; }
.bo-recent h3 { margin: 0 0 8px; font-size: 1rem; }
.bo-recent-list { display: flex; flex-direction: column; gap: 8px; }
.bo-recent-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 12px; text-align: left; font-family: inherit; color: inherit;
  background: var(--surface, #fff); border: 1px solid var(--border, #e4e7ec); border-radius: 14px; cursor: pointer; }
.bo-recent-item:hover { border-color: var(--bo-main); }
.bo-recent-thumb { display: inline-flex; width: 40px; height: 40px; flex: 0 0 auto; align-items: center; justify-content: center; border-radius: 10px; background: var(--bo-main-soft); color: var(--bo-main); }
.bo-recent-thumb svg { width: 22px; height: 22px; }
.bo-recent-main { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.bo-recent-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bo-recent-main small { color: var(--muted, #667085); }

@media (max-width: 600px) {
  /* telefon: satır kartı; onay kutusu sağ üstte, ürün satırı en üstte */
  #ocr-result table.m-cards tr { position: relative; padding: 10px 12px 8px; border-left: 4px solid var(--border-strong, #d0d5dd); }
  #ocr-result table.m-cards tr.bo-row-ok { border-left-color: var(--ok, #2e8b57); }
  #ocr-result table.m-cards tr.bo-row-new { border-left-color: var(--bo-blue); }
  #ocr-result table.m-cards td:first-child { position: absolute; top: 4px; right: 4px; padding: 0; width: 44px; height: 44px; align-items: center; justify-content: center; z-index: 1; }
  #ocr-result table.m-cards td:first-child input { width: 26px; height: 26px; max-width: none; }
  #ocr-result table.m-cards td[data-label="Ürün"] { display: block; padding-right: 44px; text-align: left; font-weight: 600; }
  #ocr-result table.m-cards td[data-label="Ürün"]::before { content: none; }
  #ocr-result table.m-cards td input[type="number"] { max-width: 120px; }
  #ocr-result table.m-cards td[data-label^="Birim fiyat"] { flex-wrap: wrap; justify-content: flex-end; }
  #ocr-result table.m-cards td select.vat-select { max-width: 100%; flex: 1 1 100%; }
  #ocr-result table.m-cards tfoot { display: none; }
  .bo-bar { margin-left: -12px; margin-right: -12px; }
  .bo-bar-btn { flex: 1 1 auto; }
  .bo-drop { padding: 24px 12px 18px; }
  .bo-camera-btn { min-height: 58px; }
  .bo-kind select, .bo select { font-size: 16px; }
  /* yeni tasarımda alt gezinme çubuğu sabit: çubuk onun üstünde dursun */
  .yt .bo-bar { bottom: var(--yt-bottom-h, 90px); padding-bottom: 10px; }
}
@media (max-width: 820px) { .yt .bo-bar { bottom: var(--yt-bottom-h, 90px); padding-bottom: 10px; } }

/* Gün Sonu (Z raporu) okutma bölümü: Fatura Okut ile aynı yakalama bileşeni; çubuk Z kartının hemen altında. */
.bo-zform { display: contents; }
/* düğme kartın İÇİNDE, normal akışta (yapışkan değil): altındaki içerikle ya da kartın kenarıyla bitişmez */
.bo-zform .bo-zbar { position: static; margin: 16px 0 0; padding: 0; border: 0; background: transparent; box-shadow: none; }
.bo-zform .bo-zbar .bo-bar-btn { width: 100%; }
.bo-zform #zreport-multipage-btn { min-height: 44px; }
.bo-zform .bo-change-btn, .bo-zform #zr-change-btn { min-height: 44px; }
