/* Tailwind is loaded via tailwind.js */
/* DataTables: ซ่อน "ไม่พบข้อมูล" จนกว่า ajax ยิงเสร็จ (เพิ่ม dt-hide-empty ที่ parent ก่อน init) */
.dt-hide-empty .dataTables_empty {
  display: none !important;
}

/* Cusstom Scrollbar*/
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.4);
}

::-webkit-scrollbar-thumb:active {
  background: rgba(0, 0, 0, 0.9);
}

/* Mobile sidebar overlay */
.sidebar-overlay {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Sidebar slide animation */
.sidebar-nav {
  transition: transform 0.3s ease-in-out;
}


/* QR SVG should fill its box */
.qr-box svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* PrimeVue mount containers should reserve input height */
.pv-date-mount {
  display: block;
  min-height: 2.5rem;
  /* ~40px */
  position: relative;
}

/* PrimeVue DatePicker minimal styling (no primevue css in repo) */
#specimenCollectionDate.p-datepicker-input,
#specimenCollectionDate.p-inputtext,
#specimenReceivedDateTime.p-datepicker-input,
#specimenReceivedDateTime.p-inputtext,
#pathologyDob.p-datepicker-input,
#pathologyDob.p-inputtext {
  width: 100%;
  border: 1px solid #d1d5db;
  /* gray-300 */
  background: #ffffff;
  color: #111827;
  /* gray-900 */
  border-radius: 0.375rem;
  /* rounded-md */
  font-size: 0.875rem;
  /* text-sm */
  line-height: 1.25rem;
  padding: 0.5rem 0.75rem;
  /* py-2 px-3 */
  outline: none;
  box-sizing: border-box;
  padding-right: 2.25rem;
  /* match icon right (pe-9) */
}

html.dark #specimenCollectionDate.p-datepicker-input,
html.dark #specimenCollectionDate.p-inputtext,
html.dark #specimenReceivedDateTime.p-datepicker-input,
html.dark #specimenReceivedDateTime.p-inputtext,
html.dark #pathologyDob.p-datepicker-input,
html.dark #pathologyDob.p-inputtext {
  border-color: #4b5563;
  /* gray-600 */
  background: #374151;
  /* gray-700 */
  color: #ffffff;
}

#specimenCollectionDate.p-datepicker-input:focus,
#specimenCollectionDate.p-inputtext:focus,
#specimenReceivedDateTime.p-datepicker-input:focus,
#specimenReceivedDateTime.p-inputtext:focus,
#pathologyDob.p-datepicker-input:focus,
#pathologyDob.p-inputtext:focus {
  border-color: #60a5fa;
  /* blue-400 */
  box-shadow: 0 0 0 1px rgba(191, 219, 254, 1);
  /* ring-blue-200 */
}

/* PrimeVue DatePicker panel (basic visibility without primevue css) */
:root {
  /* Fixed panel size (override PrimeVue inline width/min-width) */
  --pv-dp-panel-w: 280px;
  --pv-dp-panel-max-h: 520px;
  /* Scale inner UI based on panel width */
  --pv-dp-cell: clamp(1.35rem, calc(var(--pv-dp-panel-w) / 11), 2rem);
  --pv-dp-cal-font: clamp(0.65rem, calc(var(--pv-dp-panel-w) / 380), 0.75rem);
  --pv-dp-header-pad: clamp(0.4rem, calc(var(--pv-dp-panel-w) / 500), 0.75rem);
  --pv-dp-btn-font: clamp(0.75rem, calc(var(--pv-dp-panel-w) / 320), 0.875rem);
}

.p-datepicker-panel {
  position: absolute;
  background: #ffffff !important;
  color: #111827;
  /* gray-900 */
  border: 1px solid #e5e7eb;
  /* gray-200 */
  border-radius: 0.75rem;
  /* rounded-xl */
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  overflow: hidden;
  z-index: 1000;
  box-sizing: border-box;
  width: var(--pv-dp-panel-w) !important;
  min-width: var(--pv-dp-panel-w) !important;
  max-width: var(--pv-dp-panel-w) !important;
  max-height: var(--pv-dp-panel-max-h) !important;
  overflow-y: auto;
}

html.dark .p-datepicker-panel {
  background: #111827 !important;
  /* gray-900 */
  color: #ffffff !important;
  border-color: #374151;
  /* gray-700 */
}

/* PrimeVue DatePicker day text color */
html:not(.dark) .p-datepicker-panel .p-datepicker-day-cell,
html:not(.dark) .p-datepicker-panel .p-datepicker-other-month {
  color: #111827 !important;
  /* black in light */
}

html.dark .p-datepicker-panel .p-datepicker-day-cell {
  color: #ffffff !important;
}

/* Other-month days: slightly muted in dark only */
html.dark .p-datepicker-panel .p-datepicker-other-month {
  color: #9ca3af !important;
  /* gray-400 */
}

/* PrimeVue DatePicker wrapper should not look like a panel */
.p-datepicker.p-component {
  width: 100%;
  display: block;
  position: relative;
  background: transparent;
  border: 0;
  box-shadow: none;
  overflow: visible;
  z-index: auto;
}

/* PrimeVue DatePicker input: align with Tailwind inputs */
input.p-inputtext.p-datepicker-input,
input.p-inputtext.p-component.p-datepicker-input {
  width: 100%;
  border: 1px solid #d1d5db;
  /* gray-300 */
  background: #ffffff;
  color: #111827;
  /* gray-900 */
  border-radius: 0.375rem;
  /* rounded-md */
  font-size: 0.875rem;
  /* text-sm */
  line-height: 1.25rem;
  padding: 0.5rem 0.75rem;
  /* py-2 px-3 */
  outline: none;
  box-sizing: border-box;
}

html.dark input.p-inputtext.p-datepicker-input,
html.dark input.p-inputtext.p-component.p-datepicker-input {
  border-color: #4b5563;
  /* gray-600 */
  background: #374151;
  /* gray-700 */
  color: #ffffff;
}

input.p-inputtext.p-datepicker-input:focus,
input.p-inputtext.p-component.p-datepicker-input:focus {
  border-color: #60a5fa;
  /* blue-400 */
  box-shadow: 0 0 0 1px rgba(191, 219, 254, 1);
  /* ring-blue-200 */
}

.p-datepicker-panel .p-datepicker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: var(--pv-dp-header-pad);
  border-bottom: 1px solid #e5e7eb;
  box-sizing: border-box;
}

/* Header background like section headers */
html:not(.dark) .p-datepicker-panel .p-datepicker-header {
  background: #f3f4f6;
  /* gray-100 */
  color: #111827 !important;
}

html.dark .p-datepicker-panel .p-datepicker-header {
  background: #374151;
  /* gray-700 */
  color: #ffffff !important;
}

html.dark .p-datepicker-panel .p-datepicker-header {
  border-bottom-color: #374151;
}

.p-datepicker-panel .p-datepicker-calendar {
  width: 100%;
  border-collapse: collapse;
}

/* Day grid spacing (match PrimeVue look) */
.p-datepicker-panel table.p-datepicker-day-view {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.p-datepicker-panel th.p-datepicker-weekday-cell {
  font-weight: 600;
}

/* PrimeVue renders day number inside span.p-datepicker-day */
.p-datepicker-panel td.p-datepicker-day-cell {
  padding: 0 !important;
  height: var(--pv-dp-cell);
}

.p-datepicker-panel td.p-datepicker-day-cell>span.p-datepicker-day {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--pv-dp-cell);
  height: var(--pv-dp-cell);
  margin: 0 auto;
  border-radius: 0.5rem;
  font-size: var(--pv-dp-cal-font);
}

html:not(.dark) .p-datepicker-panel .p-datepicker-day {
  color: #111827 !important;
}

html.dark .p-datepicker-panel .p-datepicker-day {
  color: #ffffff !important;
}

/* Calendar + time text colors */
html:not(.dark) .p-datepicker-panel .p-datepicker-calendar,
html:not(.dark) .p-datepicker-panel .p-datepicker-time-picker,
html:not(.dark) .p-datepicker-panel .p-datepicker-time-picker span,
html:not(.dark) .p-datepicker-panel .p-datepicker-buttonbar {
  color: #111827 !important;
}

/* Weekday header + title buttons (month/year) */
html:not(.dark) .p-datepicker-panel .p-datepicker-weekday-cell,
html:not(.dark) .p-datepicker-panel .p-datepicker-weekday,
html:not(.dark) .p-datepicker-panel .p-datepicker-title button,
html:not(.dark) .p-datepicker-panel .p-datepicker-prev-button,
html:not(.dark) .p-datepicker-panel .p-datepicker-next-button {
  color: #111827 !important;
}

html.dark .p-datepicker-panel .p-datepicker-calendar,
html.dark .p-datepicker-panel .p-datepicker-time-picker,
html.dark .p-datepicker-panel .p-datepicker-time-picker span,
html.dark .p-datepicker-panel .p-datepicker-buttonbar {
  color: #ffffff !important;
}

html.dark .p-datepicker-panel .p-datepicker-weekday-cell,
html.dark .p-datepicker-panel .p-datepicker-weekday,
html.dark .p-datepicker-panel .p-datepicker-title button,
html.dark .p-datepicker-panel .p-datepicker-prev-button,
html.dark .p-datepicker-panel .p-datepicker-next-button {
  color: #ffffff !important;
}

/* Ensure weekday labels are visible */
.p-datepicker-panel .p-datepicker-weekday {
  opacity: 1 !important;
  font-weight: 600;
}

.p-datepicker-panel .p-datepicker-calendar th,
.p-datepicker-panel .p-datepicker-calendar td {
  text-align: center;
  padding: 0.125rem;
  font-size: var(--pv-dp-cal-font);
  box-sizing: border-box;
}

.p-datepicker-panel .p-datepicker-calendar td button,
.p-datepicker-panel .p-datepicker-calendar td .p-button {
  width: var(--pv-dp-cell);
  height: var(--pv-dp-cell);
  border-radius: 0.5rem;
}

.p-datepicker-panel .p-datepicker-buttonbar {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: var(--pv-dp-header-pad);
  border-top: 1px solid #e5e7eb;
  box-sizing: border-box;
}

html.dark .p-datepicker-panel .p-datepicker-buttonbar {
  border-top-color: #374151;
}

.p-datepicker-panel .p-datepicker-buttonbar .p-button {
  padding: 0.4rem 0.6rem;
  border-radius: 0.5rem;
  font-size: var(--pv-dp-btn-font);
}

/* Custom Done button styles */
.p-datepicker-panel .pv-datepicker-buttonbar {
  gap: 0.5rem;
  flex-wrap: wrap;
}

.p-datepicker-panel .pv-dp-btn {
  border: 1px solid #d1d5db;
  background: transparent;
  color: inherit;
  flex: 1 1 auto;
}

html.dark .p-datepicker-panel .pv-dp-btn {
  border-color: #4b5563;
  color: #ffffff !important;
}

html:not(.dark) .p-datepicker-panel .pv-dp-btn {
  color: #111827 !important;
}

.p-datepicker-panel .pv-dp-btn--primary {
  border-color: transparent;
  background: #2563eb;
  /* primary */
  color: #ffffff;
}

.p-datepicker-panel .pv-dp-btn--primary:hover {
  background: #1d4ed8;
  /* blue-700 */
}

/* Mobile: keep DatePicker compact */
@media (max-width: 640px) {
  :root {
    --pv-dp-panel-w: 280px;
  }

  /* sizing now driven by CSS variables above */
}


/* SweetAlert2: Mobile fullscreen */
@media (max-width: 767px) {
  .sidebar-nav {
    transform: translateX(-100%);
    height: 100vh;
    height: 100dvh;
  }

  .sidebar-nav.active {
    transform: translateX(0);
  }

  .swal2-container {
    padding: 0 !important;
  }

  .swal2-container .swal2-popup {
    width: 100vw !important;
    max-width: 100vw !important;
    min-height: 100vh !important;
    margin: 0 !important;
    border-radius: 0 !important;
  }
}

@media (min-width: 768px) {
  .sidebar-nav {
    transform: translateX(0) !important;
  }
}

/* Mobile: Remove max-height for card container */
@media (max-width: 1023px) {
  .main-card-container {
    max-height: none !important;
  }
}

/* Select2 Custom Styling to match Tailwind Inputs */
.select2-container .select2-selection--single {
  height: 50px !important;
  /* Matches py-3 + border + font line-height approx */
  padding: 10px 12px !important;
  border-radius: 0.5rem !important;
  /* rounded-lg */
  border-color: #d1d5db !important;
  /* border-gray-300 */
}

.dark .select2-container .select2-selection--single {
  background-color: #374151 !important;
  /* bg-gray-700 */
  border-color: #4b5563 !important;
  /* border-gray-600 */
  color: white !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 28px !important;
  padding-left: 0 !important;
  color: #111827 !important;
  /* text-gray-900 */
}

.dark .select2-container--default .select2-selection--single .select2-selection__rendered {
  color: white !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  display: none !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  padding-right: 12px !important;
  /* Add padding since arrow is gone */
}

/* Clear button styling */
.select2-container--default .select2-selection--single .select2-selection__clear {
  color: #ef4444;
  /* text-red-500 */
  font-size: 30px;
  /* Increased size */
  line-height: 48px;
  /* Match height */
  position: absolute;
  right: 12px;
  top: 0;
  height: 100%;
  display: flex !important;
  /* Ensure generic display */
  align-items: center;
  z-index: 10;
  font-weight: 900;
  /* Increased weight (Thicker) */
}

.select2-container--default .select2-selection--single .select2-selection__clear:hover {
  color: #dc2626;
  /* text-red-600 */
}

/* Light mode dropdown - Fix white text issue */
.select2-dropdown {
  background-color: #ffffff !important;
  border-color: #d1d5db !important;
  color: #111827 !important;
}

.select2-search__field {
  background-color: #ffffff !important;
  color: #111827 !important;
  border-color: #d1d5db !important;
}

.select2-container--default .select2-results__option {
  background-color: #ffffff !important;
  color: #111827 !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: #3b82f6 !important;
  color: #ffffff !important;
}

.select2-container--default .select2-results__option[aria-selected="true"] {
  background-color: #e5e7eb !important;
  color: #111827 !important;
}

/* Dark mode dropdown */
.dark .select2-dropdown {
  background-color: #374151;
  border-color: #4b5563;
  color: white;
}

.dark .select2-search__field {
  background-color: #4b5563;
  color: white;
  border-color: #6b7280;
}

.dark .select2-container--default .select2-results__option {
  background-color: #374151 !important;
  color: #ffffff !important;
}

.dark .select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: #2563eb;
}

.dark .select2-container--default .select2-results__option[aria-selected="true"] {
  background-color: #4b5563;
}

/* modal grossing */
.modal-enter {
  opacity: 0;
  transform: scale(0.95);
}

.modal-enter-active {
  opacity: 1;
  transform: scale(1);
  transition: all 0.25s ease-out;
}

.modal-exit {
  opacity: 1;
  transform: scale(1);
}

.modal-exit-active {
  opacity: 0;
  transform: scale(0.95);
  transition: all 0.2s ease-in;
}

/* Quill editor styles */
.ql-editor code,
.texteditor-container .ql-editor code {
  background: #1f2933;
  color: #e5e7eb;
  padding: 2px 6px;
  border-radius: 6px;
  font-family: ui-monospace, monospace;
  font-size: 0.9em;
}

.ql-editor hr,
.texteditor-container .ql-editor hr {
  margin: 1.5em 0;
}

/* Override Quill Snow - fix toolbar layout so all buttons show */
.texteditor-container .ql-toolbar {
  border: none;
  background: transparent;
  padding: 0;
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 0.25rem;
  align-items: center;
}

.texteditor-container .ql-toolbar .ql-stroke {
  display: none;
}

.texteditor-container .ql-toolbar .ql-fill {
  display: none;
}

/* Override Quill's fixed button size - allow our SVG icons to show */
.texteditor-container .ql-toolbar button {
  float: none !important;
  width: auto !important;
  height: auto !important;
  min-width: 2rem;
  min-height: 2rem;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  color: #6b7280;
}

.texteditor-container .ql-toolbar button svg {
  float: none !important;
  width: 1.25rem !important;
  height: 1.25rem !important;
  flex-shrink: 0;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.texteditor-container .ql-toolbar button svg,
.texteditor-container .ql-toolbar button svg path {
  stroke: #6b7280 !important;
  stroke-width: 2;
}

.texteditor-container .ql-toolbar button:hover svg,
.texteditor-container .ql-toolbar button:hover svg path {
  stroke: #111827 !important;
}

/* Dark mode - SVG stroke color */
.dark .texteditor-container .ql-toolbar button {
  color: #9ca3af;
}

.dark .texteditor-container .ql-toolbar button svg,
.dark .texteditor-container .ql-toolbar button svg path {
  stroke: #9ca3af !important;
  stroke-width: 2;
}

.dark .texteditor-container .ql-toolbar button:hover svg,
.dark .texteditor-container .ql-toolbar button:hover svg path {
  stroke: #f3f4f6 !important;
}

/* Hide Quill's ::before pseudo that might overlay our SVG */
.texteditor-container .ql-toolbar button::before {
  display: none !important;
  content: none !important;
}

.texteditor-container .ql-toolbar .ql-picker {
  float: none !important;
}

.texteditor-container .ql-toolbar .ql-formats {
  display: inline-flex !important;
  align-items: center;
  float: none !important;
  margin-right: 0 !important;
}

.texteditor-container .ql-toolbar .ql-picker-label {
  padding: 0.25rem 0.5rem;
  border: none;
}

.texteditor-container .ql-toolbar .ql-picker-options {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  padding: 0.25rem;
}

.dark .texteditor-container .ql-toolbar .ql-picker-options {
  background: #1f2937;
  border-color: #374151;
}

.texteditor-container .ql-toolbar .ql-picker.ql-expanded .ql-picker-label {
  color: inherit;
}

/* Active state for toolbar buttons */
.texteditor-container .ql-toolbar button.ql-active {
  background-color: rgb(229 231 235);
  color: rgb(17 24 32);
}

.texteditor-container .ql-toolbar button.ql-active svg,
.texteditor-container .ql-toolbar button.ql-active svg path {
  stroke: #111827 !important;
}

.dark .texteditor-container .ql-toolbar button.ql-active {
  background-color: rgb(55 65 81);
  color: rgb(243 244 246);
}

.dark .texteditor-container .ql-toolbar button.ql-active svg,
.dark .texteditor-container .ql-toolbar button.ql-active svg path {
  stroke: #f3f4f6 !important;
}

/* Quill editor styling - ไม่มี border รอบพื้นที่พิมพ์ */
.texteditor-container .ql-container {
  font-family: inherit;
  font-size: 1rem;
  border: none;
  min-height: 10rem;
}

.texteditor-container .ql-editor {
  min-height: 10rem;
  padding: 0.75rem;
}

.texteditor-container .ql-editor.ql-blank::before {
  color: #9ca3af;
  font-style: normal;
}

/* Header sizes in editor (Quill uses h1-h6) */
.texteditor-container .ql-editor h1 {
  font-size: 2em;
  margin: 0.5em 0;
}

.texteditor-container .ql-editor h2 {
  font-size: 1.5em;
  margin: 0.5em 0;
}

.texteditor-container .ql-editor h3 {
  font-size: 1.25em;
  margin: 0.4em 0;
}

.texteditor-container .ql-editor h4 {
  font-size: 1.1em;
  margin: 0.4em 0;
}

.texteditor-container .ql-editor h5 {
  font-size: 1em;
  margin: 0.3em 0;
}

.texteditor-container .ql-editor h6 {
  font-size: 0.9em;
  margin: 0.3em 0;
}

/* Blockquote styling */
.texteditor-container .ql-editor blockquote {
  color: #6b7280;
  quotes: "\201C" "\201D" "\2018" "\2019";
  margin-bottom: 1.6em;
  font-size: 1.11111em;
  font-style: italic;
  font-weight: 700;
}

.texteditor-container .ql-editor blockquote::before {
  content: "";
  color: #9ca3af;
  background-image: url("data:image/svg+xml,%3Csvg width='32' height='24' viewBox='0 0 32 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M18.6893 24V14.1453C18.6893 6.54 23.664 1.38533 30.6667 -7.15256e-07L31.9933 2.868C28.7507 4.09066 26.6667 7.71867 26.6667 10.6667H32V24H18.6893ZM-9.53674e-07 24V14.1453C-9.53674e-07 6.54 4.99733 1.384 12 -7.15256e-07L13.328 2.868C10.084 4.09066 8 7.71867 8 10.6667L13.3107 10.6667V24H-9.53674e-07Z' fill='%239CA3AF'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  width: 1.77778em;
  height: 1.33333em;
  margin-top: 1.6em;
  display: block;
}

.dark .texteditor-container .ql-editor blockquote {
  color: #9ca3af;
}

.dark .texteditor-container .ql-editor blockquote::before {
  color: #6b7280;
  background-image: url("data:image/svg+xml,%3Csvg width='32' height='24' viewBox='0 0 32 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M18.6893 24V14.1453C18.6893 6.54 23.664 1.38533 30.6667 -7.15256e-07L31.9933 2.868C28.7507 4.09066 26.6667 7.71867 26.6667 10.6667H32V24H18.6893ZM-9.53674e-07 24V14.1453C-9.53674e-07 6.54 4.99733 1.384 12 -7.15256e-07L13.328 2.868C10.084 4.09066 8 7.71867 8 10.6667L13.3107 10.6667V24H-9.53674e-07Z' fill='%236B7280'/%3E%3C/svg%3E");
}

/* Light mode - editor text */
.texteditor-container .ql-editor {
  color: #111827;
  background: #ffffff;
}

.texteditor-container .ql-editor.ql-blank::before {
  color: #9ca3af;
}

/* Dark mode - editor text */
.dark .texteditor-container .ql-editor {
  color: #f3f4f6;
  background: #111827;
}

.dark .texteditor-container .ql-editor.ql-blank::before {
  color: #6b7280;
}

/* Ordered list - 1. แล้ว 1.1, 1.2 ไหลไปเรื่อยๆ (ไม่มี a., b.) */
.texteditor-container .ql-editor li[data-list=ordered] {
  padding-left: 2.5em !important;
}

.texteditor-container .ql-editor li[data-list=ordered][class*="ql-indent-"] {
  padding-left: calc(2.5em + 3.5em * var(--oi)) !important;
}

.texteditor-container .ql-editor li[data-list=ordered].ql-indent-1 {
  --oi: 1;
}

.texteditor-container .ql-editor li[data-list=ordered].ql-indent-2 {
  --oi: 2;
}

.texteditor-container .ql-editor li[data-list=ordered].ql-indent-3 {
  --oi: 3;
}

.texteditor-container .ql-editor li[data-list=ordered].ql-indent-4 {
  --oi: 4;
}

.texteditor-container .ql-editor li[data-list=ordered].ql-indent-5 {
  --oi: 5;
}

.texteditor-container .ql-editor li[data-list=ordered].ql-indent-6 {
  --oi: 6;
}

.texteditor-container .ql-editor li[data-list=ordered].ql-indent-7 {
  --oi: 7;
}

.texteditor-container .ql-editor li[data-list=ordered].ql-indent-8 {
  --oi: 8;
}

.texteditor-container .ql-editor li[data-list=ordered].ql-indent-9 {
  --oi: 9;
}

.texteditor-container .ql-editor li[data-list=ordered]>.ql-ui:before {
  width: auto;
  min-width: 11em;
  margin-left: -11em;
}

.texteditor-container .ql-editor li[data-list=ordered]:not([class*="ql-indent-"])>.ql-ui:before {
  min-width: 2em;
  margin-left: -2em;
}

.texteditor-container .ql-editor li[data-list=ordered].ql-indent-1>.ql-ui:before {
  content: counter(list-0) '.' counter(list-1) '. ';
}

.texteditor-container .ql-editor li[data-list=ordered].ql-indent-2>.ql-ui:before {
  content: counter(list-0) '.' counter(list-1) '.' counter(list-2) '. ';
}

.texteditor-container .ql-editor li[data-list=ordered].ql-indent-3>.ql-ui:before {
  content: counter(list-0) '.' counter(list-1) '.' counter(list-2) '.' counter(list-3) '. ';
}

.texteditor-container .ql-editor li[data-list=ordered].ql-indent-4>.ql-ui:before {
  content: counter(list-0) '.' counter(list-1) '.' counter(list-2) '.' counter(list-3) '.' counter(list-4) '. ';
}

.texteditor-container .ql-editor li[data-list=ordered].ql-indent-5>.ql-ui:before {
  content: counter(list-0) '.' counter(list-1) '.' counter(list-2) '.' counter(list-3) '.' counter(list-4) '.' counter(list-5) '. ';
}

.texteditor-container .ql-editor li[data-list=ordered].ql-indent-6>.ql-ui:before {
  content: counter(list-0) '.' counter(list-1) '.' counter(list-2) '.' counter(list-3) '.' counter(list-4) '.' counter(list-5) '.' counter(list-6) '. ';
}

.texteditor-container .ql-editor li[data-list=ordered].ql-indent-7>.ql-ui:before {
  content: counter(list-0) '.' counter(list-1) '.' counter(list-2) '.' counter(list-3) '.' counter(list-4) '.' counter(list-5) '.' counter(list-6) '.' counter(list-7) '. ';
}

.texteditor-container .ql-editor li[data-list=ordered].ql-indent-8>.ql-ui:before {
  content: counter(list-0) '.' counter(list-1) '.' counter(list-2) '.' counter(list-3) '.' counter(list-4) '.' counter(list-5) '.' counter(list-6) '.' counter(list-7) '.' counter(list-8) '. ';
}

.texteditor-container .ql-editor li[data-list=ordered].ql-indent-9>.ql-ui:before {
  content: counter(list-0) '.' counter(list-1) '.' counter(list-2) '.' counter(list-3) '.' counter(list-4) '.' counter(list-5) '.' counter(list-6) '.' counter(list-7) '.' counter(list-8) '.' counter(list-9) '. ';
}

/* Text without explicit color inherits editor color (blockquote มี style แยก) */
.texteditor-container .ql-editor p,
.texteditor-container .ql-editor h1,
.texteditor-container .ql-editor h2,
.texteditor-container .ql-editor h3,
.texteditor-container .ql-editor h4,
.texteditor-container .ql-editor h5,
.texteditor-container .ql-editor h6,
.texteditor-container .ql-editor li {
  color: inherit;
}

.dark .texteditor-container .ql-editor p,
.dark .texteditor-container .ql-editor h1,
.dark .texteditor-container .ql-editor h2,
.dark .texteditor-container .ql-editor h3,
.dark .texteditor-container .ql-editor h4,
.dark .texteditor-container .ql-editor h5,
.dark .texteditor-container .ql-editor h6,
.dark .texteditor-container .ql-editor li {
  color: inherit;
}

/* Link style - สีน้ำเงินมีเส้นใต้ */
.texteditor-container .ql-editor a {
  color: #2563eb;
  text-decoration: underline;
}

.texteditor-container .ql-editor a:hover {
  color: #1d4ed8;
}

.dark .texteditor-container .ql-editor a {
  color: #60a5fa;
}

.dark .texteditor-container .ql-editor a:hover {
  color: #93c5fd;
}

/* Color picker dropdown - light mode */
.texteditor-container .ql-toolbar .ql-picker.ql-expanded .ql-picker-options {
  background: #ffffff;
  border-color: #e5e7eb;
  color: #111827;
}

.texteditor-container .ql-toolbar .ql-picker.ql-expanded .ql-picker-item {
  color: #111827;
}

/* Color picker dropdown - dark mode */
.dark .texteditor-container .ql-toolbar .ql-picker.ql-expanded .ql-picker-options {
  background: #1f2937;
  border-color: #374151;
  color: #f3f4f6;
}

.dark .texteditor-container .ql-toolbar .ql-picker.ql-expanded .ql-picker-item {
  color: #f3f4f6;
}

.dark .texteditor-container .ql-toolbar .ql-picker.ql-expanded .ql-picker-label {
  color: #d1d5db;
}

/* Select dropdowns - dark mode */
.dark .texteditor-container .ql-toolbar select.ql-header,
.dark .texteditor-container .ql-toolbar select.ql-size,
.dark .texteditor-container .ql-toolbar select.ql-color,
.dark .texteditor-container .ql-toolbar select.ql-background {
  color: #d1d5db;
}

.dark .texteditor-container .ql-toolbar select.ql-header option,
.dark .texteditor-container .ql-toolbar select.ql-size option {
  background: #1f2937;
  color: #f3f4f6;
}

/* Color dropdown */
.texteditor-color-dropdown[data-open="true"] {
  display: block !important;
}

.texteditor-container .texteditor-color-swatch {
  padding: 0;
}

.texteditor-container .texteditor-color-swatch:focus {
  outline: 2px solid rgb(59 130 246);
  outline-offset: 1px;
}

.texteditor-container img {
  border-radius: 0.5rem;
}

/* Tooltip styles */
.texteditor-tooltip {
  position: fixed;
  pointer-events: none;
  white-space: nowrap;
  z-index: 9999 !important;
  transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
  background-color: #374151;
  color: #ffffff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  line-height: 1.5;
}

.texteditor-tooltip.visible {
  visibility: visible !important;
  opacity: 1 !important;
}

.texteditor-tooltip:not(.visible) {
  visibility: hidden !important;
  opacity: 0 !important;
}

.texteditor-tooltip-arrow {
  position: absolute;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid #374151;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-1px);
}