/* Custom Styles for QR & Barcode Studio */

/* Proporsional Compact Scaling (~85%) hanya di Desktop / Layar Lebar */
@media (min-width: 1024px) {
  body {
    zoom: 0.85;
  }
}

/* Android & Mobile UI Enhancements */
* {
  -webkit-tap-highlight-color: transparent;
}

.scrollbar-none {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.scrollbar-none::-webkit-scrollbar {
  display: none;
}

/* Bottom Navigation Safe Area */
nav.fixed.bottom-0 {
  padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
}

/* Light Mode Bottom Navigation */
html:not(.dark) nav.fixed.bottom-0 {
  background-color: rgba(255, 255, 255, 0.95);
  border-color: #e2e8f0;
  box-shadow: 0 -8px 25px rgba(0, 0, 0, 0.08);
}

html:not(.dark) nav.fixed.bottom-0 button {
  color: #64748b;
}

html:not(.dark) nav.fixed.bottom-0 button.text-brand-400 {
  color: #4f46e5 !important;
}

/* Mobile & Android Touch Optimization */
@media (max-width: 768px) {
  html {
    -webkit-text-size-adjust: 100%;
  }

  /* Input font 16px di Android cegah auto zoom paksa saat diketik */
  .custom-input,
  input,
  select,
  textarea {
    font-size: 16px !important;
  }

  /* Chips tipe QR di Android berbentuk Pill horizontal swipe */
  .qr-type-btn {
    flex-direction: row !important;
    min-height: 40px;
    border-radius: 9999px !important;
    padding: 0.5rem 0.875rem !important;
    font-size: 0.8125rem !important;
    white-space: nowrap;
  }
  .qr-type-btn svg {
    width: 1rem;
    height: 1rem;
  }

  .btn-primary,
  .btn-secondary,
  .btn-outline {
    min-height: 46px;
    border-radius: 0.875rem;
  }

  /* Preview QR & Barcode responsif di HP */
  #qrCanvasContainer,
  #barcodeCanvasContainer {
    max-width: 100% !important;
    overflow-x: auto;
  }
  #qrCanvasContainer canvas,
  #barcodeCanvasContainer svg {
    max-width: 100% !important;
    height: auto !important;
  }
}

/* Custom Inputs */
.custom-input {
  width: 100%;
  background-color: #0f172a !important;
  border: 1.5px solid #334155 !important;
  border-radius: 0.75rem;
  padding: 0.65rem 0.875rem;
  font-size: 0.875rem;
  color: #ffffff !important;
  outline: none;
  transition: all 0.2s ease;
}

.custom-input::placeholder {
  color: #94a3b8 !important;
  opacity: 1;
}

.custom-input:focus {
  border-color: #6366f1 !important;
  background-color: #1e293b !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25) !important;
}

/* Light Mode Overrides */
html:not(.dark) body {
  background-color: #f8fafc;
  color: #0f172a;
}

html:not(.dark) header {
  background-color: rgba(255, 255, 255, 0.85);
  border-color: #e2e8f0;
}

html:not(.dark) header span.bg-clip-text {
  background-image: linear-gradient(to right, #0f172a, #334155);
}

html:not(.dark) #themeToggleBtn,
html:not(.dark) #openScannerBtn {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
}

html:not(.dark) .tab-btn.text-slate-400 {
  color: #64748b;
}

html:not(.dark) div.bg-slate-900 {
  background-color: #ffffff;
  border-color: #e2e8f0;
}

html:not(.dark) div.bg-slate-900\/90 {
  background-color: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

html:not(.dark) .custom-input {
  background-color: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #0f172a !important;
}

html:not(.dark) .custom-input::placeholder {
  color: #64748b !important;
}

html:not(.dark) .qr-type-btn {
  background-color: #f1f5f9;
  border-color: #e2e8f0;
  color: #475569;
}

html:not(.dark) .qr-type-btn:hover {
  background-color: #e2e8f0;
  color: #0f172a;
}

html:not(.dark) .qr-type-btn.active {
  background-color: #6366f1;
  color: #ffffff;
}

html:not(.dark) #scanResultBox {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
}

html:not(.dark) #scanResultText {
  color: #0f172a;
}

html:not(.dark) footer {
  border-color: #e2e8f0;
  color: #64748b;
}

/* Tab button styles */
.tab-btn.active {
  background-color: rgb(99 102 241);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

/* QR Type badges */
.qr-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.625rem 0.5rem;
  border-radius: 0.875rem;
  background-color: rgb(15 23 42 / 0.6);
  border: 1px solid rgb(51 65 85 / 0.5);
  font-size: 0.75rem;
  font-weight: 600;
  color: rgb(148 163 184);
  transition: all 0.15s ease;
  cursor: pointer;
}

.qr-type-btn svg {
  width: 1.125rem;
  height: 1.125rem;
}

.qr-type-btn:hover {
  background-color: rgb(30 41 59);
  color: rgb(241 245 249);
  border-color: rgb(71 85 105);
}

.qr-type-btn.active {
  background-color: rgb(99 102 241);
  border-color: rgb(99 102 241);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: white;
  transition: all 0.2s ease;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: rgb(30 41 59);
  color: rgb(226 232 240);
  border: 1px solid rgb(51 65 85);
  transition: all 0.2s ease;
}
.btn-secondary:hover {
  background-color: rgb(51 65 85);
  color: white;
}

.btn-outline {
  background-color: transparent;
  color: rgb(203 213 225);
  border: 1px solid rgb(51 65 85);
  transition: all 0.2s ease;
}
.btn-outline:hover {
  background-color: rgb(30 41 59);
  color: white;
  border-color: rgb(71 85 105);
}

/* History Card */
.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1rem;
  border-radius: 0.875rem;
  background-color: rgb(15 23 42 / 0.6);
  border: 1px solid rgb(51 65 85 / 0.6);
  transition: all 0.2s ease;
}
.history-item:hover {
  border-color: rgb(99 102 241 / 0.5);
  background-color: rgb(15 23 42 / 0.9);
}

/* Label Sticker Item */
.label-card {
  background: #ffffff;
  border: 1px dashed #cbd5e1;
  border-radius: 0.5rem;
  padding: 0.625rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #0f172a;
  page-break-inside: avoid;
}

/* Print CSS */
@media print {
  body * {
    visibility: hidden;
  }

  /* When printing single code */
  #qrCanvasContainer,
  #qrCanvasContainer *,
  #barcodeCanvasContainer,
  #barcodeCanvasContainer * {
    visibility: visible;
  }

  #qrCanvasContainer,
  #barcodeCanvasContainer {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    box-shadow: none !important;
    border: none !important;
  }

  /* When printing label sheets */
  body.printing-sheet #qrCanvasContainer,
  body.printing-sheet #barcodeCanvasContainer {
    visibility: hidden !important;
  }

  body.printing-sheet #bulkPrintSheet,
  body.printing-sheet #bulkPrintSheet * {
    visibility: visible;
  }

  body.printing-sheet #bulkPrintSheet {
    position: absolute;
    left: 0;
    top: 0;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    overflow: visible !important;
  }
}
