/* TeknikServis — birleşik barkod / QR tarayıcı (dış saha / admin tasarım dili) */

/* ── QR sheet overlay ──────────────────────────────────────────────────── */
.ts-barkod-sheet {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.ts-barkod-sheet--open {
  visibility: visible;
  pointer-events: auto;
  opacity: 1;
}

.ts-barkod-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

.ts-barkod-sheet-card {
  position: relative;
  width: 100%;
  max-width: 520px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: min(90vh, 640px);
}

/* servis-detay-header ile aynı dil */
.ts-barkod-sheet-header {
  padding: 18px 20px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: #fff;
  flex-shrink: 0;
}

.ts-barkod-sheet-title {
  margin: 0;
  font-size: 18px;
  font-weight: bold;
  color: #333;
  line-height: 1.3;
}

.ts-barkod-sheet-close {
  flex-shrink: 0;
  background: #d9534f;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  transition: background 0.3s ease;
}

.ts-barkod-sheet-close:hover {
  background: #c9302c;
  color: #fff;
}

.ts-barkod-sheet-body {
  padding: 12px 16px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Form alanı kutusu — diğer modallardaki gri panel */
.ts-barkod-sheet-panel {
  background: #f9f9f9;
  padding: 12px;
  border-radius: 8px;
  border-top: 2px solid #3498db;
}

.ts-barkod-sheet-hint {
  margin: 0 0 10px;
  font-size: 13px;
  color: #666;
  text-align: center;
  line-height: 1.4;
}

/* ── Kamera alanı ──────────────────────────────────────────────────────── */
.barkod-camera-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 240px;
  background: #111;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #dfe6e9;
}

.barkod-camera-wrap--compact {
  max-height: 180px;
  border-radius: 0;
  border-left: none;
  border-right: none;
}

.barkod-reader-slot,
.barkod-camera-wrap > .ts-barkod-video-wrap,
.barkod-camera-wrap > [id$="Reader"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.ts-barkod-video-wrap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #111;
}

.ts-barkod-video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Tarama çerçevesi — marka mavisi */
.barkod-corner-marks {
  position: absolute;
  inset: 10%;
  pointer-events: none;
  z-index: 3;
}

.barkod-corner {
  position: absolute;
  width: 20px;
  height: 20px;
  border-color: #3498db;
  border-style: solid;
  border-width: 0;
  opacity: 0.9;
}

.barkod-corner-tl {
  top: 0;
  left: 0;
  border-top-width: 3px;
  border-left-width: 3px;
  border-radius: 4px 0 0 0;
}

.barkod-corner-tr {
  top: 0;
  right: 0;
  border-top-width: 3px;
  border-right-width: 3px;
  border-radius: 0 4px 0 0;
}

.barkod-corner-bl {
  bottom: 0;
  left: 0;
  border-bottom-width: 3px;
  border-left-width: 3px;
  border-radius: 0 0 0 4px;
}

.barkod-corner-br {
  bottom: 0;
  right: 0;
  border-bottom-width: 3px;
  border-right-width: 3px;
  border-radius: 0 0 4px 0;
}

.barkod-scan-line {
  position: absolute;
  left: 10%;
  right: 10%;
  height: 2px;
  top: 20%;
  background: linear-gradient(90deg, transparent, rgba(52, 152, 219, 0.2), #3498db, rgba(52, 152, 219, 0.2), transparent);
  box-shadow: 0 0 6px rgba(52, 152, 219, 0.5);
  pointer-events: none;
  z-index: 4;
  animation: tsBarkodScanLine 2.4s ease-in-out infinite;
}

@keyframes tsBarkodScanLine {
  0%, 100% { top: 20%; opacity: 0.4; }
  10% { opacity: 1; }
  50% { top: 80%; opacity: 1; }
  90% { opacity: 1; }
}

/* Durum metni */
.barkod-durum {
  margin: 10px 0 0;
  padding: 8px 10px;
  font-size: 13px;
  color: #666;
  text-align: center;
  line-height: 1.4;
  background: #fff;
  border-radius: 6px;
  border: 1px solid #eceff1;
}

.barkod-durum--hazir {
  color: #27ae60;
  border-color: #c8e6c9;
  background: #f1f8f4;
}

.barkod-durum--hata {
  color: #e74c3c;
  border-color: #f5c6cb;
  background: #fdf3f2;
}

/* Admin: arizali-cihaz-ekle barkod modal */
#barkodOkuyucuModal .modal-dialog {
  max-width: 520px;
  margin: 1rem auto;
}

#barkodOkuyucuModal .modal-body {
  padding: 12px !important;
  background: #fff !important;
}

#barkod-reader {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 240px;
  overflow: hidden;
  border-radius: 8px;
  background: #111;
  border: 1px solid #dfe6e9;
}

#barkod-reader video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

/* Stok sorgulama inline panel */
#stokBarkodScannerPanel .barkod-camera-wrap--compact {
  max-height: clamp(120px, 22vh, 180px);
}

#stokBarkodReader {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0 !important;
  max-height: none !important;
  background: transparent;
}

#stokBarkodReader > div {
  width: 100% !important;
  height: 100% !important;
}

@media (max-width: 480px) {
  .ts-barkod-sheet {
    align-items: flex-start;
    justify-content: center;
    padding: max(12px, env(safe-area-inset-top, 0px) + 12px) 12px 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .ts-barkod-sheet-card {
    border-radius: 12px;
    max-width: 100%;
  }

  .ts-barkod-sheet-title {
    font-size: 17px;
  }

  .barkod-camera-wrap {
    max-height: min(210px, 34vh);
  }
}
