/* ==========================================================================
   TRF ERP - Advanced UI Components
   ========================================================================== */

/* --- General Utilities --- */
.extra-small {
  font-size: 0.7rem;
}

.bg-slate-50 {
  background-color: #f8fafc;
}

/* --- Timeline Component (History) --- */
.list-timeline {
  padding: 1rem 0;
  margin: 0;
  list-style: none;
  position: relative;
}

.list-timeline:before {
  content: "";
  background: #e6e7e9;
  width: 2px;
  height: 100%;
  position: absolute;
  left: 17px;
  top: 0;
}

.list-timeline > li {
  position: relative;
  margin-bottom: 2.5rem;
  padding-left: 45px;
}

.list-timeline > li:last-child {
  margin-bottom: 0;
}

.list-timeline-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  border: 4px solid #fff;
}

.list-timeline-time {
  margin-bottom: 0.5rem;
}

/* --- Ticket Component (QR Requisition) --- */
.ticket-container {
  max-width: 500px;
  margin: 2rem auto;
}

.dashed-line {
  border-top: 2px dashed #cbd5e1;
  margin: 20px 0;
}

.qr-wrapper {
  background: #fff;
  padding: 10px;
  border-radius: 8px;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  display: inline-block;
}

#qrcode img {
  margin: auto;
}

.erp-brand {
  border-left: 4px solid #0054a6;
  padding-left: 15px;
}

.status-pill {
  transform: rotate(-2deg);
  box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.1);
}

/* --- QR Scanner Engine --- */
#reader {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: none !important;
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

#reader__status_span {
  font-size: 12px;
  color: #64748b;
}

.scanner-container {
  max-width: 600px;
  margin: 0 auto;
}

.scanner-overlay {
  background: rgba(0, 0, 0, 0.4);
  border-radius: 12px;
  padding: 20px;
  position: relative;
}

.scanner-branding {
  border-bottom: 3px solid #0054a6;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
}

.scan-success-flash {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(34, 197, 94, 0.2);
  animation: flash 0.5s ease-out;
  pointer-events: none;
  z-index: 20;
  display: none;
}

@keyframes flash {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.camera-controls {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: center;
}

/* --- Global Scanner FAB (Shared Layout) --- */
.fab-scanner {
  position: fixed;
  bottom: 45px;
  right: 30px;
  width: 65px;
  height: 65px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0054a6 0%, #002b5c 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(0, 84, 166, 0.4);
  z-index: 1050;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border: 3px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  text-decoration: none !important;
}

.fab-scanner:hover {
  transform: scale(1.1) translateY(-5px);
  box-shadow: 0 15px 30px rgba(0, 84, 166, 0.5);
  color: white;
}

.fab-scanner i {
  font-size: 28px;
}

.fab-scanner .pulse {
  position: absolute;
  width: 100%;
  height: 100%;
  background: inherit;
  border-radius: inherit;
  opacity: 0.6;
  z-index: -1;
  animation: fab-pulse 2s infinite;
}

@keyframes fab-pulse {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

/* --- OnBehalf & Form Elements --- */
.ts-control {
  border-radius: 8px !important;
  padding: 10px 12px !important;
  border: 1px solid #e2e8f0 !important;
  background-color: #ffffff !important;
}
.ts-dropdown {
  border-radius: 8px !important;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1) !important;
  border: 1px solid #f1f5f9 !important;
  background-color: #ffffff !important;
  z-index: 1000 !important;
}
/* --- Advanced Dropdowns (TomSelect) --- */
.adv-select-option {
  display: flex;
  align-items: center;
  padding: 2px 0;
}
.adv-select-img-container {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  margin-right: 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
}
.adv-select-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}
.adv-select-initial {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  color: #475569;
  font-weight: 800;
  font-size: 1.25rem;
  text-transform: uppercase;
}

/* Selected Item Mini-Preview */
.adv-select-mini-container {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
}
.adv-select-mini-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.adv-select-mini-initial {
  font-size: 10px;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
}

.adv-select-title {
  font-weight: 600;
  font-size: 13.5px;
  color: #1e293b;
  line-height: 1.2;
}
.adv-select-subtitle {
  font-size: 10px;
  color: #64748b;
  font-weight: 700;
  text-transform: uppercase;
  margin-top: 3px;
}

.section-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: #94a3b8;
  border-bottom: 2px solid #f1f5f9;
  padding-bottom: 4px;
}

/* --- Print Behavior Overrides --- */
@media print {
  .no-print,
  .fab-scanner,
  .d-print-none {
    display: none !important;
  }
  .ticket-container {
    margin: 0;
    max-width: 100%;
  }
  .card {
    border: none !important;
    box-shadow: none !important;
  }
}

/* --- Global DataTables Search Styling --- */
.dataTables_wrapper .dataTables_filter {
  float: none;
  text-align: left;
  margin-bottom: 1rem;
}

.dataTables_wrapper .dataTables_filter label {
  display: block;
  width: 100%;
  margin-left: 0;
  font-size: 0; /* Hide 'Search:' text */
  position: relative;
}

/* Custom Search Input Design */
.dataTables_wrapper .dataTables_filter input {
  width: 100% !important;
  margin-left: 0 !important;
  font-size: 0.875rem !important;
  padding: 0.6rem 1rem 0.6rem 2.5rem !important; /* Left padding for icon */
  border: 1px solid #dce1e7 !important;
  border-radius: 4px !important;
  background-color: #fff !important;
  /* SVG Search Icon encoded */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='icon icon-tabler icon-tabler-search' width='24' height='24' viewBox='0 0 24 24' stroke-width='2' stroke='%236e7582' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath stroke='none' d='M0 0h24v24H0z' fill='none'/%3E%3Ccircle cx='10' cy='10' r='7' /%3E%3Cline x1='21' y1='21' x2='15' y2='15' /%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: 10px center !important;
  background-size: 1.1rem !important;
  transition: all 0.3s ease;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.dataTables_wrapper .dataTables_filter input:focus {
  border-color: #90b5e2 !important;
  box-shadow: 0 0 0 0.25rem rgba(32, 107, 196, 0.25) !important;
  outline: 0;
}

/* Pagination & Info Styling tweaks */
.dataTables_wrapper .dataTables_info {
  padding-top: 1rem !important;
  font-size: 0.8rem;
  color: #6e7582;
}

.dataTables_wrapper .dataTables_paginate {
  padding-top: 1rem !important;
}

.dataTables_wrapper .dataTables_length {
  color: #6e7582;
  font-size: 0.8rem;
}

/* --- Search Term Highlighting --- */
.highlight {
  background-color: #ffe16b;
  color: #1d273b;
  border-radius: 2px;
  padding: 0 2px;
  font-weight: 700;
  box-shadow: 0 1px 1px rgba(0,0,0,0.1);
}

.card-link-hover {
  transition: all 0.2s ease !important;
  cursor: pointer;
}
.card-link-hover:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(0,0,0,0.1) !important;
  z-index: 2;
  border-color: #206bc4 !important;
}
