@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai+Looped:wght@300;400;500;600;700;800&family=Prompt:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=Sarabun:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #dbeafe;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --cargo-orange: #ea580c;
  --cargo-orange-light: #ffedd5;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
}

body {
  font-family: 'Noto Sans Thai Looped', 'Prompt', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #f8fafc;
  color: #1e293b;
  font-size: 13.5px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.font-sarabun {
  font-family: 'Sarabun', sans-serif;
}

.font-noto {
  font-family: 'Noto Sans Thai Looped', sans-serif;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Card hover glow */
.card-shadow {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease-in-out;
}
.card-shadow:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

/* Table styling (Tight padding & reduced empty space) */
.custom-table th {
  background-color: #f1f5f9;
  color: #334155;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.01em;
  padding: 0.45rem 0.4rem;
  border-bottom: 2px solid #cbd5e1;
}

.custom-table td {
  padding: 0.38rem 0.4rem;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.825rem;
  vertical-align: middle;
}

.custom-table tr:hover td {
  background-color: #f8fafc;
}

/* Input fields */
.input-field {
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
.input-field:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

/* Badge styling */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.725rem;
  font-weight: 600;
  line-height: 1.1;
}

.badge-volume {
  background-color: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.badge-weight {
  background-color: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

/* Upload Dropzone styling */
.dropzone-border {
  border: 2px dashed #94a3b8;
  transition: all 0.2s ease-in-out;
}
.dropzone-border:hover, .dropzone-border.dragover {
  border-color: #2563eb;
  background-color: #eff6ff;
}

/* Collapsible Details styling */
details summary::-webkit-details-marker {
  display: none;
}
details summary {
  list-style: none;
}

/* Tab Active / Inactive */
.tab-btn {
  transition: all 0.15s ease-in-out;
}
.tab-btn.active {
  background-color: #ffffff;
  color: #1d4ed8;
  border-color: #3b82f6;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}
.tab-btn:not(.active) {
  background-color: transparent;
  color: #64748b;
  border-color: transparent;
}
.tab-btn:not(.active):hover {
  background-color: #f1f5f9;
  color: #1e293b;
}

/* Expandable child rows */
.child-row {
  background-color: #f8fafc !important;
}
.child-row td {
  padding-top: 0.25rem !important;
  padding-bottom: 0.25rem !important;
  padding-left: 0.35rem !important;
  padding-right: 0.35rem !important;
  font-size: 0.8rem !important;
  border-bottom: 1px dashed #e2e8f0 !important;
}

/* ========================================================
   A4 Landscape Print Stylesheet (ปริ้น A4 แนวนอน)
   ======================================================== */
@page {
  size: A4 landscape;
  margin: 5mm 6mm;
}

@media print {
  html, body {
    width: 100% !important;
    height: auto !important;
    background-color: #ffffff !important;
    color: #0f172a !important;
    font-family: 'Noto Sans Thai Looped', sans-serif !important;
    font-size: 7.5pt !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .no-print {
    display: none !important;
  }

  .print-only {
    display: block !important;
  }

  /* Expand full container width */
  main {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .card-shadow {
    box-shadow: none !important;
    border: none !important;
  }

  /* Table formatting for A4 Landscape */
  table.custom-table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 7.5pt !important;
    table-layout: auto !important;
  }

  .custom-table th {
    background-color: #e2e8f0 !important;
    color: #0f172a !important;
    border: 1px solid #94a3b8 !important;
    padding: 3px 4px !important;
    font-weight: 700 !important;
    font-size: 7pt !important;
    white-space: nowrap !important;
  }

  .custom-table td {
    border: 1px solid #cbd5e1 !important;
    padding: 2.5px 3.5px !important;
    font-size: 7.2pt !important;
    vertical-align: middle !important;
  }

  input.input-field {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    box-shadow: none !important;
    font-size: 7.2pt !important;
    width: auto !important;
    max-width: 100% !important;
    color: inherit !important;
  }

  .custom-table tfoot, thead {
    display: table-header-group !important;
  }

  .custom-table tfoot tr, #topSummaryRow {
    background-color: #0f172a !important;
    color: #ffffff !important;
  }

  .custom-table tfoot td, #topSummaryRow td {
    border: 1px solid #0f172a !important;
    color: #ffffff !important;
    font-weight: bold !important;
    padding: 3px 4px !important;
  }

  tr {
    page-break-inside: avoid !important;
    page-break-after: auto !important;
  }
}
