/*------------------------------------------------------------------
    File Name: custom.css
-------------------------------------------------------------------*/

/** ADD YOUR AWESOME CODES HERE **/

/* ============================================================
   Modern File Upload (drag-and-drop dropzone)
   Auto-applied to all input[type=file].form-control-file
   ============================================================ */
.modern-upload-zone {
  position: relative;
  border: 2px dashed #d1d5db;
  border-radius: 12px;
  background: #fafbfc;
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 8px;
  user-select: none;
}
.modern-upload-zone:hover {
  border-color: #667eea;
  background: #f3f4ff;
}
.modern-upload-zone[data-state="dragover"] {
  border-color: #667eea;
  border-style: solid;
  background: #eef2ff;
  transform: scale(1.01);
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.15);
}
.modern-upload-zone[data-state="filled"] {
  border-style: solid;
  border-color: #10b981;
  background: #f0fdf4;
  padding: 12px;
  text-align: left;
  cursor: default;
}
.modern-upload-zone[data-state="filled"]:hover {
  border-color: #059669;
  background: #ecfdf5;
}
.modern-upload-icon {
  display: flex;
  justify-content: center;
  color: #9ca3af;
  margin-bottom: 10px;
  transition: color 0.2s ease;
}
.modern-upload-zone:hover .modern-upload-icon { color: #667eea; }
.modern-upload-zone[data-state="dragover"] .modern-upload-icon { color: #4f46e5; }
.modern-upload-text-main {
  font-size: 0.95rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 4px;
}
.modern-upload-text-sub {
  font-size: 0.85rem;
  color: #6b7280;
}
.modern-upload-link {
  color: #667eea;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.modern-upload-hint {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 8px;
}
.modern-upload-filled {
  display: flex;
  align-items: center;
  gap: 12px;
}
.modern-upload-preview {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
}
.modern-upload-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.modern-upload-filename {
  font-size: 0.9rem;
  font-weight: 600;
  color: #111827;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.modern-upload-filesize {
  font-size: 0.8rem;
  color: #6b7280;
}
.modern-upload-filesize .badge-compressed {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  background: #dbeafe;
  color: #1e40af;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}
.modern-upload-remove {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: #ef4444;
  color: white;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
  transition: all 0.15s ease;
}
.modern-upload-remove:hover {
  background: #dc2626;
  transform: scale(1.08);
}

/* hide original file input + native preview img once enhanced */
.modern-upload-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
}

/* ============================================================
   OCR auto-fill highlight (สำหรับ inputs ที่ถูก fill อัตโนมัติจาก slip OCR)
   ============================================================ */
.input-ocr-filled {
  border-color: #10b981 !important;
  background-color: #f0fdf4 !important;
  animation: ocrPulseGreen 1.5s ease-out 1;
  transition: background-color 0.3s, border-color 0.3s;
}
.input-ocr-default {
  border-color: #f59e0b !important;
  background-color: #fffbeb !important;
  animation: ocrPulseAmber 1.5s ease-out 1;
  transition: background-color 0.3s, border-color 0.3s;
}
@keyframes ocrPulseGreen {
  0%   { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
  100% { box-shadow: 0 0 0 14px rgba(16, 185, 129, 0); }
}
@keyframes ocrPulseAmber {
  0%   { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.6); }
  100% { box-shadow: 0 0 0 14px rgba(245, 158, 11, 0); }
}