/* ==========================================================================
   Nokta Bilişim Kargo Etiket Sistemi - Monokrom (Siyah-Beyaz) Termal Stil
   Özel 80mm x 60mm Xprinter XP-DT325B Termal Baskı Desteği
   ========================================================================== */

:root {
  --primary: #0f172a;
  --primary-hover: #1e293b;
  --accent: #2563eb;
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-500: #64748b;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --radius: 8px;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.06);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: #f1f5f9;
  color: var(--slate-900);
  line-height: 1.5;
  min-height: 100vh;
}

/* Header */
.app-header {
  background: white;
  border-bottom: 2px solid #000000;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo-img {
  height: 42px;
  max-width: 220px;
  object-fit: contain;
}

.brand-titles h1 {
  font-size: 1.15rem;
  font-weight: 900;
  color: #000000;
  letter-spacing: -0.02em;
}

.brand-titles p {
  font-size: 0.8rem;
  color: #475569;
  font-weight: 600;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  background: #f8fafc;
  color: #000000;
  border: 1px solid #000000;
}

.status-badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #000000;
}

.header-actions {
  display: flex;
  gap: 8px;
}

/* Layout */
.app-container {
  max-width: 1560px;
  margin: 20px auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1fr 520px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1200px) {
  .app-container {
    grid-template-columns: 1fr;
  }
}

/* Card */
.card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--slate-300);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 1rem;
  font-weight: 800;
  color: #000000;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--slate-200);
  padding-bottom: 8px;
}

/* Form Elements */
.form-group {
  margin-bottom: 14px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 5px;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--slate-300);
  border-radius: 6px;
  font-size: 0.9rem;
  color: #000000;
  background-color: white;
  outline: none;
  transition: border-color 0.15s ease;
}

.form-control:focus {
  border-color: #000000;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

textarea.form-control {
  resize: vertical;
  min-height: 65px;
  font-family: inherit;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Shop Fetch Bar */
.shop-fetch-box {
  background: #0f172a;
  color: white;
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 20px;
  border: 2px solid #000000;
}

.shop-fetch-box h2 {
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.shop-fetch-box p {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-bottom: 12px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-primary {
  background-color: #000000;
  color: white;
  border-color: #000000;
}
.btn-primary:hover {
  background-color: #1e293b;
}

.btn-secondary {
  background-color: white;
  color: #000000;
  border-color: #cbd5e1;
}
.btn-secondary:hover {
  background-color: #f8fafc;
  border-color: #000000;
}

.btn-accent {
  background: white;
  color: #000000;
  border-color: #ffffff;
}
.btn-accent:hover {
  background: #f1f5f9;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 13px 20px;
  font-size: 1rem;
}

/* Badges / Checkboxes */
.badges-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.badge-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  color: #000000;
  user-select: none;
  transition: all 0.15s ease;
}

.badge-check input[type="checkbox"] {
  accent-color: #000000;
}

.badge-check:has(input:checked) {
  background: #000000;
  color: #ffffff;
  border-color: #000000;
}

/* Logo Mode Switcher (Logolu / Logosuz) */
.logo-switch-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  margin-bottom: 12px;
}

.logo-switch-btn {
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  color: #475569;
  transition: all 0.15s ease;
}

.logo-switch-btn.active {
  background: #000000;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   RIGHT COLUMN: DUAL LIVE PREVIEW (80x60mm ALICI & GÖNDERİCİ)
   ========================================================================== */
.preview-sticky {
  position: sticky;
  top: 80px;
}

.preview-wrapper {
  background: #ffffff;
  border-radius: var(--radius);
  border: 2px solid #000000;
  box-shadow: var(--shadow-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.preview-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid #000000;
}

.preview-tabs {
  display: flex;
  gap: 6px;
  width: 100%;
  margin-bottom: 12px;
}

.preview-tab-btn {
  flex: 1;
  padding: 8px 10px;
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
  border: 1.5px solid #000000;
  background: #ffffff;
  color: #000000;
  cursor: pointer;
  border-radius: 6px;
}

.preview-tab-btn.active {
  background: #000000;
  color: #ffffff;
}

.labels-preview-area {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

/* THE 80mm x 60mm PHYSICAL THERMAL LABEL STYLING (PURE BLACK & WHITE, ENLARGED LEGIBLE FONTS) */
.thermal-label-box {
  width: 440px;
  height: 330px; /* 80x60mm 4:3 exact aspect ratio on screen */
  background: #ffffff;
  border: 2px solid #000000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
  color: #000000;
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
  overflow: hidden;
  position: relative;
}

/* Top Section */
.t-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #000000;
  padding-bottom: 3px;
  min-height: 36px;
  max-height: 42px;
  gap: 8px;
  overflow: hidden;
}

.t-large-company-title {
  font-size: 18px;
  font-weight: 900;
  color: #000000;
  letter-spacing: 0.4px;
  line-height: 1.1;
  text-transform: uppercase;
  word-break: break-word;
  max-width: 280px;
}

.t-badge-mini {
  font-size: 9.5px;
  font-weight: 900;
  border: 1.5px solid #000000;
  padding: 1px 5px;
  margin-top: 2px;
  display: inline-block;
}

.t-logo-area {
  display: flex;
  align-items: center;
  max-width: 230px;
  flex-shrink: 1;
}

.t-logo-area img {
  max-height: 34px;
  max-width: 210px;
  width: auto;
  object-fit: contain;
  filter: grayscale(100%) contrast(200%);
}

.t-meta-right {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  flex-shrink: 0;
  white-space: nowrap;
}

.t-badge-type {
  background: #000000;
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 900;
  padding: 2px 8px;
  letter-spacing: 0.5px;
  display: inline-block;
  white-space: nowrap;
  line-height: 1.2;
}

.t-date {
  font-size: 11px;
  font-weight: 800;
  color: #000000;
  margin-top: 2px;
  line-height: 1;
  white-space: nowrap;
}

/* Barcode Area */
.t-barcode-area {
  padding: 1px 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 44px;
}

.t-barcode-area svg {
  max-height: 42px;
  width: 96%;
}

.t-qr-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.t-qr-row svg {
  max-height: 44px;
  max-width: 44px;
}

/* Main Content Box */
.t-content-box {
  border: 2.5px solid #000000;
  padding: 5px 8px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin-top: 2px;
  background: #ffffff;
}

.t-box-title {
  font-size: 11.5px;
  font-weight: 900;
  letter-spacing: 0.3px;
  border-bottom: 2px solid #000000;
  padding-bottom: 3px;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.t-box-title span {
  white-space: nowrap;
}

.t-name {
  font-size: 16.5px;
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: 4px;
  word-break: break-word;
  color: #000000;
}

.t-address {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.25;
  flex-grow: 1;
  word-break: break-word;
  white-space: pre-line;
  color: #000000;
}

.t-bottom-info {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-top: 2px solid #000000;
  padding-top: 3px;
  margin-top: 3px;
}

.t-city {
  font-size: 15.5px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.t-phone {
  font-size: 12.5px;
  font-weight: 900;
}

/* Footer Flags */
.t-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 3px;
  font-size: 10px;
  font-weight: 900;
}

.t-flag {
  border: 2px solid #000000;
  padding: 2px 7px;
  font-weight: 900;
  text-transform: uppercase;
  font-size: 10.5px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #ffffff;
  color: #000000;
  line-height: 1.1;
}

.t-flag-cod {
  background: #000000;
  color: #ffffff;
  border: 2px solid #000000;
  padding: 2px 7px;
  font-weight: 900;
  text-transform: uppercase;
  font-size: 10.5px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 1.1;
}

.t-flag svg, .t-flag-cod svg {
  display: inline-block;
  vertical-align: middle;
}

/* PREVIEW ACTIONS */
.preview-actions {
  width: 100%;
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-print-both {
  width: 100%;
  padding: 13px 18px;
  font-size: 1.05rem;
  font-weight: 900;
  background: #000000;
  color: #ffffff;
  border: 2px solid #000000;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.15s ease;
}

.btn-print-both:hover {
  background: #1e293b;
}

.split-print-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.65);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.modal-content {
  background: white;
  border-radius: var(--radius);
  max-width: 580px;
  width: 90%;
  padding: 24px;
  border: 2px solid #000000;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid #000000;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: #000000;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  color: #000000;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 12px 18px;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 700;
  background: #000000;
  color: #ffffff;
  border: 1px solid #ffffff;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.2s ease-out;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ==========================================================================
   PRINT STYLES FOR XPRINTER XP-DT325B (80mm x 60mm)
   Supports printing 1 label or 2 labels consecutively (Alıcı + Gönderici)
   ========================================================================== */
@media print {
  @page {
    size: 80mm 60mm;
    margin: 0 !important;
  }

  html, body {
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    width: 80mm !important;
  }

  /* Hide entire UI */
  .app-header,
  .shop-fetch-box,
  .form-section,
  .preview-header,
  .preview-tabs,
  .preview-actions,
  .modal-overlay,
  .toast-container {
    display: none !important;
  }

  .app-container, .preview-sticky, .preview-wrapper, .labels-preview-area {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    width: 80mm !important;
  }

  /* Print Pages: Scaled proportionally from 440x330 preview to 80x60mm physical paper */
  .thermal-label-box {
    width: 80mm !important;
    height: 60mm !important;
    max-width: 80mm !important;
    max-height: 60mm !important;
    margin: 0 !important;
    padding: 1.8mm 2.2mm !important;
    box-sizing: border-box !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    background: #ffffff !important;
    page-break-after: always !important;
    break-after: page !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .thermal-label-box .t-header {
    min-height: 26px !important;
    max-height: 30px !important;
    padding-bottom: 2px !important;
  }

  .thermal-label-box .t-logo-area img {
    max-height: 24px !important;
    max-width: 145px !important;
  }

  .thermal-label-box .t-large-company-title {
    font-size: 13.5px !important;
  }

  .thermal-label-box .t-badge-type {
    font-size: 8.5px !important;
    padding: 1.5px 5px !important;
  }

  .thermal-label-box .t-date {
    font-size: 8px !important;
  }

  .thermal-label-box .t-barcode-area {
    min-height: 30px !important;
  }

  .thermal-label-box .t-barcode-area svg {
    max-height: 30px !important;
  }

  .thermal-label-box .t-content-box {
    padding: 3.5px 6px !important;
    border-width: 2px !important;
  }

  .thermal-label-box .t-box-title {
    font-size: 8.5px !important;
    padding-bottom: 2px !important;
    margin-bottom: 2px !important;
  }

  .thermal-label-box .t-name {
    font-size: 12px !important;
    line-height: 1.15 !important;
  }

  .thermal-label-box .t-address {
    font-size: 10px !important;
    line-height: 1.2 !important;
    font-weight: 700 !important;
  }

  .thermal-label-box .t-city {
    font-size: 11.5px !important;
  }

  .thermal-label-box .t-footer {
    font-size: 7.5px !important;
    margin-top: 2px !important;
  }

  .thermal-label-box .t-flag,
  .thermal-label-box .t-flag-cod {
    font-size: 7.5px !important;
    padding: 1.5px 5px !important;
  }

  .thermal-label-box:last-child {
    page-break-after: avoid !important;
    break-after: avoid !important;
  }

  /* Conditional printing modes: set by JS */
  body.print-only-recipient #label-sender {
    display: none !important;
  }

  body.print-only-sender #label-recipient {
    display: none !important;
  }
}
