/* ==========================================================================
   Gallant POS / TradingERP - Barcode Print Styling
   Fully self-contained, independent of global Bootstrap CSS
   ========================================================================== */

.barcode-print-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 20px 60px;
  font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #1e293b;
}

/* Page Top Header */
.bp-header-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.bp-header-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bp-header-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #eff6ff;
  color: #3b82f6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.bp-header-text h2 {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 2px 0;
  line-height: 1.2;
}

.bp-header-text p {
  font-size: 13px;
  color: #64748b;
  margin: 0;
}

/* Cards */
.bp-card {
  background: #ffffff;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 14px;
  box-shadow: 0 2px 14px rgba(15, 23, 42, 0.04);
  margin-bottom: 20px;
  position: relative;
  transition: all 0.2s ease;
}

.bp-card-header {
  padding: 14px 20px;
  background: #f8fafc;
  border-bottom: 1px solid #edf2f7;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top-left-radius: 14px;
  border-top-right-radius: 14px;
}

.bp-card-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.bp-card-title i {
  color: #3b82f6;
  font-size: 18px;
}

.bp-card-body {
  padding: 20px;
}

/* Search Bar Card */
.bp-search-card {
  position: relative;
}

.bp-search-input-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.2s ease;
}

.bp-search-input-wrap:focus-within {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.bp-scan-trigger-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  border: none;
  border-right: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #334155;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}

.bp-scan-trigger-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.bp-search-field-inner {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.bp-search-icon {
  position: absolute;
  left: 14px;
  font-size: 18px;
  color: #94a3b8;
  pointer-events: none;
}

.bp-search-input {
  width: 100%;
  height: 48px;
  border: none;
  outline: none;
  padding: 0 40px 0 42px;
  font-size: 14.5px;
  color: #0f172a;
  background: transparent;
  font-family: inherit;
}

.bp-search-input::placeholder {
  color: #94a3b8;
}

.bp-search-clear-btn {
  position: absolute;
  right: 12px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: #e2e8f0;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}

.bp-search-clear-btn:hover {
  background: #cbd5e1;
  color: #0f172a;
}

/* Search Dropdown */
.bp-search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.12);
  z-index: 1050;
  max-height: 340px;
  overflow-y: auto;
}

.bp-search-dropdown-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background 0.15s;
}

.bp-search-dropdown-item:last-child {
  border-bottom: none;
}

.bp-search-dropdown-item:hover {
  background: #f8fafc;
}

.bp-item-thumb {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bp-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bp-item-thumb-placeholder {
  color: #94a3b8;
  font-size: 20px;
}

.bp-item-info {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.bp-item-title {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bp-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
}

.bp-barcode-chip {
  font-family: monospace;
  font-size: 12px;
  color: #475569;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.bp-sku-chip {
  font-size: 11.5px;
  color: #64748b;
}

.bp-item-price-tag {
  background: #eff6ff;
  color: #2563eb;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  flex-shrink: 0;
}

/* Products Table */
.bp-table-responsive {
  width: 100%;
  overflow-x: auto;
}

.bp-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.bp-table thead th {
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 14px 18px;
  border-bottom: 1px solid #e2e8f0;
}

.bp-table tbody td {
  padding: 12px 18px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.bp-table tbody tr:hover {
  background: #fafbfc;
}

.bp-prod-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bp-prod-name-wrap {
  display: flex;
  flex-direction: column;
}

.bp-prod-title {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
}

.bp-prod-sku {
  font-size: 12px;
  color: #64748b;
}

.bp-barcode-code {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #0f172a;
  padding: 4px 10px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.bp-barcode-code i {
  color: #64748b;
  font-size: 15px;
}

/* Quantity Stepper */
.bp-qty-stepper {
  display: inline-flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 2px;
  gap: 2px;
}

.bp-qty-btn {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.bp-qty-minus {
  background: #f1f5f9;
  color: #475569;
}

.bp-qty-minus:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.bp-qty-plus {
  background: #3b82f6;
  color: #ffffff;
}

.bp-qty-plus:hover {
  background: #2563eb;
}

.bp-qty-input {
  width: 50px;
  height: 30px;
  border: none;
  outline: none;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  background: transparent;
  padding: 0;
  -moz-appearance: textfield;
}

.bp-qty-input::-webkit-outer-spin-button,
.bp-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.bp-delete-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #ef4444;
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.bp-delete-btn:hover {
  background: #fee2e2;
  color: #dc2626;
}

.bp-count-badge {
  background: #eff6ff;
  color: #2563eb;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
}

.bp-link-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.bp-clear-btn {
  color: #ef4444;
}

.bp-clear-btn:hover {
  text-decoration: underline;
}

/* Empty State */
.bp-empty-state {
  padding: 44px 20px;
  text-align: center;
}

.bp-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto 14px;
}

.bp-empty-title {
  font-size: 17px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 6px 0;
}

.bp-empty-text {
  font-size: 13.5px;
  color: #64748b;
  margin: 0;
}

/* ==========================================================================
   Print Options & Dates Section (Resolved Layout Grid)
   ========================================================================== */

.bp-options-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 28px;
  align-items: start;
}

@media (max-width: 900px) {
  .bp-options-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

.bp-section-label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #475569;
  margin-bottom: 12px;
}

/* Checkboxes Grid */
.bp-checkboxes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 520px) {
  .bp-checkboxes-grid {
    grid-template-columns: 1fr;
  }
}

.bp-checkbox-tile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.bp-checkbox-tile:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.bp-checkbox-tile.active {
  border-color: #3b82f6;
  background: #eff6ff;
}

.bp-checkbox-tile input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.bp-checkbox-indicator {
  width: 19px;
  height: 19px;
  border-radius: 5px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.bp-checkbox-tile.active .bp-checkbox-indicator {
  background: #3b82f6;
  border-color: #3b82f6;
}

.bp-checkbox-indicator i {
  display: none;
}

.bp-checkbox-tile.active .bp-checkbox-indicator i {
  display: block;
}

.bp-checkbox-label {
  font-size: 13.5px;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
}

.bp-checkbox-tile.active .bp-checkbox-label {
  color: #1d4ed8;
}

/* Dates Grid */
.bp-dates-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 520px) {
  .bp-dates-grid {
    grid-template-columns: 1fr;
  }
}

.bp-form-field {
  display: flex;
  flex-direction: column;
}

.bp-field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 6px;
}

.bp-text-input {
  width: 100%;
  height: 42px;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 0 12px;
  font-size: 13.5px;
  font-weight: 500;
  color: #0f172a;
  background: #ffffff;
  outline: none;
  font-family: inherit;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.bp-text-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* ==========================================================================
   Label Settings
   ========================================================================== */

.bp-select-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.bp-select {
  width: 100%;
  height: 44px;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 0 36px 0 14px;
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  background: #ffffff;
  outline: none;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: all 0.15s ease;
}

.bp-select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.bp-select-icon {
  position: absolute;
  right: 14px;
  font-size: 16px;
  color: #64748b;
  pointer-events: none;
}

.bp-custom-dims-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 14px;
}

@media (max-width: 600px) {
  .bp-custom-dims-grid {
    grid-template-columns: 1fr;
  }
}

.bp-unit-input {
  display: flex;
  align-items: stretch;
}

.bp-unit-input .bp-text-input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.bp-unit-tag {
  background: #f1f5f9;
  border: 1.5px solid #cbd5e1;
  border-left: none;
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bp-dimension-banner {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 12px 16px;
  color: #1e40af;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.bp-banner-icon {
  font-size: 18px;
  color: #3b82f6;
  flex-shrink: 0;
}

.bp-banner-text strong {
  color: #1e3a8a;
  font-weight: 700;
}

.bp-banner-sep {
  color: #93c5fd;
  margin: 0 4px;
}

/* ==========================================================================
   Action Buttons
   ========================================================================== */

.bp-actions-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0;
}

.bp-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  font-size: 14.5px;
  font-weight: 700;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}

.bp-btn-primary {
  background: #3b82f6;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.28);
}

.bp-btn-primary:hover:not(:disabled) {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(59, 130, 246, 0.38);
}

.bp-btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.bp-btn-dark {
  background: #1e293b;
  color: #ffffff;
}

.bp-btn-dark:hover {
  background: #0f172a;
  transform: translateY(-1px);
}

.bp-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: bp-spin 0.6s linear infinite;
}

@keyframes bp-spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   Live Preview
   ========================================================================== */

.bp-preview-badge {
  background: #e2e8f0;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
}

.bp-preview-canvas {
  background-color: #f1f5f9;
  min-height: 220px;
  padding: 24px;
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 14px;
}

.bp-preview-empty {
  text-align: center;
  padding: 36px 20px;
  color: #94a3b8;
}

.bp-preview-empty-icon {
  font-size: 42px;
  margin-bottom: 10px;
  display: block;
  opacity: 0.6;
}

.bp-preview-empty p {
  margin: 0;
  font-size: 14px;
}

.barcode-preview-container {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
  justify-content: flex-start;
}

.barcode-preview-tile {
  display: inline-block;
  vertical-align: top;
  position: relative;
  flex: 0 0 auto;
  width: calc(var(--pv-w, 38mm) * var(--pv-scale, 2.35));
  height: calc(var(--pv-h, 25mm) * var(--pv-scale, 2.35));
  margin: 0;
  border-radius: 4px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
  background: #ffffff;
  overflow: hidden;
}

.barcode-preview-tile .barcode-label-preview {
  position: absolute;
  top: 0;
  left: 0;
  transform: scale(var(--pv-scale, 2.35));
  transform-origin: top left;
  backface-visibility: hidden;
}

.barcode-label-preview {
  background: #fff;
  border: 1px solid #111;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.barcode-inner {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  overflow: hidden;
}

.barcode-text {
  width: 100%;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  color: #000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  flex-shrink: 0;
}

.barcode-text.company {
  font-size: 7px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.barcode-text.name {
  font-size: 8px;
  font-weight: 700;
}

.barcode-text.code {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.5px;
}

.barcode-text.price {
  font-size: 10px;
  font-weight: 800;
}

.barcode-text.dates {
  font-size: 8px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  width: 100%;
  gap: 4px;
}

.barcode-svg-wrapper {
  width: 100%;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
}

.barcode-svg-wrapper svg,
.barcode-svg-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.barcode-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f0f0;
  color: #aaa;
  font-size: 18px;
}

/* ==========================================================================
   Scan Modal Dialog (Standalone CSS)
   ========================================================================== */

.bp-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: bp-fade-in 0.15s ease-out;
}

@keyframes bp-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.bp-modal-box {
  background: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.2);
  overflow: hidden;
  animation: bp-modal-pop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes bp-modal-pop {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.bp-modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bp-modal-header h4 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
}

.bp-modal-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: #f1f5f9;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  transition: all 0.15s;
}

.bp-modal-close-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.bp-modal-body {
  padding: 22px;
}

.bp-modal-scan-visual {
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 28px 16px;
  text-align: center;
  background: #f8fafc;
  margin-bottom: 18px;
}

.bp-modal-scan-icon {
  font-size: 40px;
  color: #64748b;
  margin-bottom: 8px;
  display: block;
}

.bp-modal-scan-visual p {
  margin: 0;
  font-size: 13.5px;
  color: #64748b;
}

.bp-modal-input-row {
  display: flex;
  gap: 8px;
}

.bp-modal-footer {
  padding: 14px 22px;
  background: #f8fafc;
  border-top: 1px solid #f1f5f9;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
