/*
  สไตล์สำหรับฟอร์มคำนวณราคากล่อง KSP

  ธีมมินิมอล ใช้โทนสีน้ำตาลอ่อนและครีมตามคำขอ
  คลาสและตัวเลือกถูกตั้งชื่อเพื่อความเข้าใจง่าย
*/

/* รูปแบบพื้นหลังและฟอนต์ของหน้า */
body {
  margin: 0;
  padding: 0;
  font-family: 'Noto Sans Thai', sans-serif;
  color: #333;
  /* ไล่สีพื้นหลังโทนน้ำตาลอ่อน */
  background: linear-gradient(135deg, #f5f0ec, #e8d8c4);
  min-height: 100vh;
  padding-bottom: 0;
}

/* ===== Navigation Tabs ===== */
/* Desktop: File-tab style at top */
.main-nav {
  background: transparent;
  padding: 0;
  box-shadow: none;
}

.nav-tabs {
  max-width: 1240px;
  margin: 0 auto;
  /* Use a single-row flex layout so tabs do not wrap to multiple rows when more items are added */
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  padding: 12px 20px 0;
  overflow-x: auto;
  /* allow horizontal scrolling if needed */
  overflow-y: hidden;
  /* prevent vertical scrollbar — only allow horizontal scroll */
  -webkit-overflow-scrolling: touch;
  align-items: flex-start;
  justify-content: flex-start;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.06) transparent;
}

/* Optional: subtle custom scrollbar for supported browsers */
.nav-tabs::-webkit-scrollbar {
  height: 8px;
}

.nav-tabs::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
}

.nav-tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(213, 197, 179, 0.6);
  border: none;
  border-radius: 12px 12px 0 0;
  color: #5a4230;
  font-size: 0.95rem;
  font-family: 'Noto Sans Thai', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: none;
  justify-content: center;
  text-align: center;
}

.nav-tab:hover:not(.active) {
  background: rgba(232, 216, 196, 0.8);
  transform: translateY(-2px);
}

.nav-tab.active {
  background: #ffffff;
  color: #5a4230;
  font-weight: bold;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
  position: relative;
  z-index: 10;
}

/* Remove any gap between active tab and container */
.nav-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: #ffffff;
}

.nav-tab .tab-icon {
  color: #a67c52;
  flex-shrink: 0;
}

.nav-tab.active .tab-icon {
  color: #8c6646;
}

.nav-tab .coming-soon {
  font-size: 0.7rem;
  background: #f5eee8;
  padding: 2px 8px;
  border-radius: 10px;
  color: #8a7468;
  margin-left: 6px;
  display: none;
}

.nav-tab .tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-tab .tab-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

/* Hide label text on mobile, show only on desktop */
@media (max-width: 1023px) {
  .main-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: #ffffff;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    padding: 0;
  }

  /* Mobile: single-row bottom nav. Use horizontal flex with no-wrap so items stay in one row
     and can scroll horizontally if there are more items than fit. */
  .nav-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 0;
    padding: 8px;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    /* avoid vertical scrollbar on small screens */
    -webkit-overflow-scrolling: touch;
    align-items: center;
    justify-content: space-around;
  }

  .nav-tabs::-webkit-scrollbar {
    height: 6px;
  }

  .nav-tabs::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.04);
    border-radius: 6px;
  }

  /* Ensure each tab keeps a reasonable tappable width while remaining a single row */
  .nav-tab {
    flex: 0 0 auto;
    /* do not grow/shrink — keep natural size */
    min-width: 64px;
    /* maintain tappable area */
  }

  .nav-tab {
    flex-direction: column;
    padding: 12px 8px;
    border-radius: 8px;
    gap: 4px;
    font-size: 0.75rem;
    border-bottom: none;
    background: transparent;
  }

  .nav-tab .tab-label {
    /* hide label on mobile - only show icon */
    display: none;
  }

  .nav-tab .coming-soon {
    display: none;
  }

  .nav-tab .tab-icon {
    /* make icon ~30% smaller on mobile (from 24px -> ~17px) */
    width: 17px;
    height: 17px;
  }

  .nav-tab.active {
    background: #f5eee8;
    border-bottom: none;
    box-shadow: none;
  }

  .nav-tab.active::after {
    display: none;
  }

  .nav-tab:hover {
    transform: none;
    background: transparent;
  }

  .nav-tab.active:hover {
    background: #f5eee8;
  }

  body {
    padding-bottom: 80px;
  }

  .container {
    margin-bottom: 20px;
  }
}

/* Tab content sections */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Materials Tab Layout - Form wider (60%), Result panel narrower (40%) */
.tab-content[data-content="materials"] .layout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  /* Result: Form = 50%:50% */
  gap: 20px;
  padding: 20px;
}

@media (max-width: 1023px) {
  .tab-content[data-content="materials"] .layout-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  /* Reduce font size by 30% on mobile for materials tab */
  .tab-content[data-content="materials"] {
    font-size: 0.7rem;
    /* ~70% of base size */
  }

  .tab-content[data-content="materials"] label {
    font-size: 0.7rem;
  }

  .tab-content[data-content="materials"] input,
  .tab-content[data-content="materials"] select,
  .tab-content[data-content="materials"] button {
    font-size: 0.7rem;
  }

  /* Paint rows - wrap fields on mobile */
  .paint-row {
    flex-wrap: wrap !important;
  }

  .paint-row .paint-job-type,
  .paint-row .paint-color-select {
    flex: 1 1 100% !important;
    min-width: 100% !important;
  }

  .paint-row .paint-surface-type {
    flex: 1 1 calc(50% - 5px) !important;
    width: auto !important;
  }

  .paint-row .paint-primer-rounds,
  .paint-row .paint-topcoat-rounds {
    flex: 1 1 calc(50% - 5px) !important;
    width: auto !important;
  }

  .paint-row .laser-slot-card-controls {
    flex: 0 0 auto !important;
    width: 100% !important;
    display: flex;
    justify-content: center;
  }
}

/* small price note shown under content with totals/notice */
.price-note {
  border: 1px solid #eee;
  background: #fff;
  padding: 10px 12px;
  margin: 12px 0 24px;
  border-radius: 6px;
  font-size: 13px;
  color: #333;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
}

.price-note .price-note-summary {
  font-weight: 600;
  margin-bottom: 6px;
}

.price-note .price-note-text {
  margin: 0;
  font-size: 12px;
  color: #666;
}

@media (max-width: 1023px) {
  .price-note {
    padding: 8px;
    margin: 8px 0 16px;
    font-size: 12px;
  }

  .price-note .price-note-summary {
    font-size: 13px;
  }
}

/* Coming soon message styling */
.coming-soon-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  text-align: center;
  color: #8a7468;
  padding: 40px 20px;
}

.coming-soon-message svg {
  color: #d5c5b3;
  margin-bottom: 20px;
}

.coming-soon-message h2 {
  color: #5a4230;
  margin: 16px 0 8px;
  font-size: 1.5rem;
}

.coming-soon-message p {
  color: #8a7468;
  font-size: 1rem;
}

/* Logo preview spinner */
.logo-preview-spinner,
.laser-logo-preview-spinner {
  position: absolute;
  left: 0;
  top: 20px;
  /* offset a bit from the very top */
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 6px;
  z-index: 50;
  /* higher z-index to ensure visibility above variant items */
}

/* Ensure spinner overlays are positioned inside their specific containers
   so they don't cover the whole page. Make variant grid and per-slot
   preview box offset parents for absolute positioned spinner. */
.laser-variant-grid,
.laser-logo-preview-box {
  position: relative;
}

/* simple CSS loader (ring) */
.lds-ring {
  display: inline-block;
  position: relative;
  width: 32px;
  height: 32px;
}

.lds-ring div {
  box-sizing: border-box;
  display: block;
  position: absolute;
  width: 24px;
  height: 24px;
  margin: 4px;
  border: 3px solid #8a7468;
  border-radius: 50%;
  animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
  border-color: #8a7468 transparent transparent transparent;
}

.lds-ring div:nth-child(1) {
  animation-delay: -0.45s;
}

.lds-ring div:nth-child(2) {
  animation-delay: -0.3s;
}

.lds-ring div:nth-child(3) {
  animation-delay: -0.15s;
}

@keyframes lds-ring {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}


/* การ์ดกลาง */
.container {
  max-width: 1240px;
  margin: 0 auto 40px;
  background: #ffffff;
  padding: 28px;
  border-radius: 14px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
}

/* หัวข้อหลัก */
h1 {
  font-size: 1.5rem;
  margin: 0 0 16px;
  text-align: center;
  color: #5a4230;
}

/* กลุ่มอินพุตแถวเดียวสามช่อง */
.row-3 {
  display: flex;
  gap: 8px;
}

.row-2 {
  display: flex;
  gap: 8px;
}

/* กลุ่มอินพุต */
.input-group {
  flex: 1;
}

/* ฉลากและอินพุต */
label {
  display: block;
  margin-top: 12px;
  margin-bottom: 4px;
  font-weight: bold;
  color: #5a4230;
}

/* Text panel (laser) - make labels smaller to match 'ประเภทเลเซอร์' compact style */
.laser-text-fields label {
  font-size: 12px;
  margin-top: 6px;
  margin-bottom: 4px;
  font-weight: 600;
  color: #5a4230;
}

/* Make the controls in the text panel slightly more compact */
.laser-text-fields input[type="text"],
.laser-text-fields input[type="number"],
.laser-text-fields select {
  font-size: 13px;
  padding: 6px;
}

/* ลดขนาดตัวอักษรสำหรับฟอร์มในแท็บ partition ลง 20% */
#partitionForm label {
  font-size: 0.7em;
  /* 70% ของขนาดพื้นฐาน */
}

/* Base styling for numeric inputs */
input[type="number"] {
  width: 100%;
  box-sizing: border-box;
  padding: 8px;
  border: 1px solid #ecdccc;
  border-radius: 6px;
  background-color: #fff;
}

/* ใช้สไตล์เดียวกับ input ตัวเลขสำหรับช่องข้อความทั่วไป */
input[type="text"] {
  width: 100%;
  box-sizing: border-box;
  padding: 8px;
  border: 1px solid #ecdccc;
  border-radius: 6px;
  background-color: #fff;
}

/* Base styling for select dropdowns */
select {
  width: 100%;
  box-sizing: border-box;
  padding: 8px;
  border: 1px solid #ecdccc;
  border-radius: 6px;
  background-color: #fff;
  /* remove default arrow styling so we can customise the dropdown arrow */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  /* add a subtle custom arrow (brown) */
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0l5 6 5-6H0z' fill='%2399806d'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 10px 6px;
}

/* Allow wrapping of long option text on small screens for better readability */
select#difficulty,
select#blockDifficulty {
  white-space: normal;
  /* allow wrapping */
}

@media (max-width: 600px) {

  select#difficulty,
  select#blockDifficulty {
    font-size: 0.95rem;
    line-height: 1.2;
    min-height: 3.2em;
    /* give space for a couple of wrapped lines */
    padding: 10px;
  }

  /* try to allow option labels to wrap when the native control permits */
  select option {
    white-space: normal;
    line-height: 1.2;
  }
}

/* ปรับสีตัวเลือกภายใน dropdown ให้โทนเดียวกับแบบฟอร์ม */
select option {
  color: #5a4230;
  background-color: #ffffff;
}

select option:checked {
  background-color: #f5eee8;
}

input[type="number"]:focus,
select:focus {
  outline: none;
  /* highlight border when the dropdown is active */
  border-color: #c5a890;
  box-shadow: 0 0 0 2px rgba(197, 168, 144, 0.3);
}

/* กล่องตัวเลือกเสริม */
.addon-box {
  margin-top: 20px;
  padding: 12px;
  background: #f9f6f3;
  border: 1px solid #ecdccc;
  border-radius: 6px;
}

.addon-box strong {
  display: block;
  margin-bottom: 8px;
  color: #5a4230;
  position: relative;
  padding-left: 18px;
}

/* เพิ่มไอคอนจุดสีน้ำตาลอ่อนนำหน้าหัวข้อ "ตัวเลือกเสริม" */
.addon-box strong::before {
  content: '\2022';
  /* bullet character */
  position: absolute;
  left: 0;
  top: 0;
  color: #a67c52;
  font-size: 1.2rem;
}

/* ช่องในส่วนซ่อน (ซ้อนบล็อก) */
.nested {
  margin-top: 8px;
  padding-left: 0;
  display: none;
}

/* การแสดงซ่อนของ nested ผ่าน JS จะตั้ง display = block */

/* กลุ่มตัวเลือกเสริมใหม่ (addon) */
.addon {
  margin-top: 8px;
  display: block;
}

/* ปรับสไตล์ checkbox ใหญ่และสวยงามตามต้นแบบ Figma */
/*
  ปรับขนาดและสีของช่อง checkbox เพื่อให้เหมือนต้นแบบ Figma มากขึ้น
  - เพิ่มขนาดเป็น 20x20px
  - ใช้สีเส้นขอบโทนน้ำตาลอ่อน
  - เมื่อเลือกแล้วให้พื้นหลังเป็นน้ำตาลเข้มและมีเครื่องหมายถูกสีขาว
*/
.addon input[type="checkbox"] {
  /* ลบสไตล์ดั้งเดิมของ checkbox */
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  margin-right: 8px;
  width: 20px;
  height: 20px;
  border: 2px solid #d5c5b3;
  border-radius: 4px;
  background-color: #fff;
  position: relative;
  cursor: pointer;
  vertical-align: middle;
  flex-shrink: 0;
}

.addon input[type="checkbox"]:checked {
  /* เมื่อเลือกแล้วให้พื้นหลังและเส้นขอบเป็นสีเข้มขึ้น */
  background-color: #5a4230;
  border-color: #5a4230;
}

.addon input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 10px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.addon label {
  font-weight: normal;
  color: #5a4230;
  cursor: pointer;
  display: inline-block;
  vertical-align: middle;
}

/* Specific vertical layout for the shipping option checkboxes (three rows) */
.vertical-column {
  /* stack each option vertically */
  flex-direction: column;
}

.vertical-column .input-group {
  /* make each option take full width of the column */
  flex: none;
  width: 100%;
}

.vertical-column .addon {
  /* align checkbox and label on one line */
  display: flex;
  align-items: center;
  gap: 8px;
}

.vertical-column .addon-content {
  /* indent addon content under the checkbox+label */
  margin-left: 28px;
}

/* เนื้อหาที่จะซ่อน/แสดงเมื่อเลือก add-on */
.addon-content {
  display: none;
  /* spacing from the checkbox section */
  margin-top: 8px;
  /* internal padding for fields */
  padding: 12px;
  /* draw a subtle container to mimic the Figma drop-down panel */
  background-color: #ffffff;
  /* สีเส้นขอบอ่อนเพื่อให้ดูนุ่มนวลเหมือนต้นแบบ */
  border: 1px solid #ecdccc;
  border-radius: 6px;
  padding-left: 16px;
}

/* แสดง addon-content เมื่อ checkbox ถูกเลือก */
.addon input[type="checkbox"]:checked+label+.addon-content {
  display: block;
}

/* ปุ่มหลัก */
button#calculateBtn {
  width: 100%;
  padding: 12px;
  margin-top: 24px;
  font-size: 1rem;
  color: #fff;
  background-color: #a67c52;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

button#calculateBtn:hover {
  background-color: #8c6646;
}

/* ปุ่มคำนวณการจัดส่ง (mobile) - ให้สไตล์เหมือนปุ่มคำนวณราคา */
button#shippingCalculateMobileBtn {
  display: inline-block;
  width: 60%;
  max-width: 360px;
  padding: 10px 16px;
  margin-top: 12px;
  font-size: 0.98rem;
  color: #fff;
  background-color: #a67c52;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  text-align: center;
}

button#shippingCalculateMobileBtn:hover {
  background-color: #8c6646;
}

/* ปุ่มคำนวณของแท็บวัสดุ (แสดงทั้งบนมือถือและเดสก์ทอป) */
button#mat_calculateBtn {
  width: 100%;
  padding: 12px;
  margin-top: 16px;
  font-size: 1rem;
  color: #fff;
  background-color: #a67c52;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  text-align: center;
}

button#mat_calculateBtn:hover {
  background-color: #8c6646;
}

/* ปุ่มเพิ่มจุดเลเซอร์และเพิ่มรายการอื่นๆ ให้มีสไตล์เรียบง่ายเหมือนต้นแบบ */
.add-laser-btn,
.add-other-btn {
  margin-top: 8px;
  padding: 6px 12px;
  background-color: #ffffff;
  border: 1px solid #d5c5b3;
  border-radius: 4px;
  color: #a67c52;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.add-laser-btn:hover,
.add-other-btn:hover {
  background-color: #f5eee8;
}

/* ปุ่มเลือกไฟล์แบบสวย */
.ksp-file-btn {
  background: #fff;
  border: 1px solid #e4d6c7;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
  width: fit-content;
  transition: 0.15s ease;
  color: #6d5446;
}

.ksp-file-btn:hover {
  background: #f8f1ea;
  border-color: #d8c6b6;
}

.ksp-file-btn input[type="file"] {
  display: none;
}

/* ใช้สไตล์เดียวกับ .ksp-file-btn สำหรับป้ายไฟล์ในแถวเลเซอร์ */
.laser-slot-file-inline {
  background: #fff;
  border: 1px solid #e4d6c7;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
  width: fit-content;
  transition: 0.15s ease;
  color: #6d5446;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 28px;
  min-width: 150px;
}

.laser-slot-file-inline:hover {
  background: #f8f1ea;
  border-color: #d8c6b6;
}

.laser-slot-file-inline input[type="file"] {
  display: none;
}

/* พื้นที่ผลลัพธ์ */
.result {
  margin-top: 24px;
  padding: 14px;
  background: #fffaf4;
  border: 1px solid #ecdccc;
  border-radius: 6px;
  color: #5a4230;
  line-height: 1.6;
  min-height: 160px;
  position: relative;
  box-sizing: border-box;
  /* ensure padding included in width calculations */
  max-width: 100%;
  /* allow long text to wrap instead of overflowing the container
     and only allow vertical scrolling (hide horizontal scroll). */
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
  overflow-x: hidden;
  /* prevent horizontal slide */
  overflow-y: auto;
  /* allow vertical scroll when needed */
}

.result-hint {
  margin: 0;
  color: #8a7468;
  font-size: 0.95rem;
}

/* หมายเหตุภายในฟิลด์เสริม */
.note {
  font-size: 0.85rem;
  color: #8a7468;
  margin-top: 4px;
}

/* ===== สไตล์ใหม่สำหรับแสดงผลรายละเอียดราคา ===== */

.result-detail {
  font-size: 0.95rem;
  line-height: 1.8;
}

/* Tighter wrapping for paragraphs inside result blocks to avoid overflow */
.result p,
.result-section p,
.result-detail p {
  white-space: pre-wrap;
  /* preserve intended line breaks */
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Make the preformatted shipping lines wrap and respect container padding
   so headings and their content stay on separate lines and do not overflow. */
pre.shipping-lines {
  white-space: pre-wrap;
  /* allow wrapping but keep line breaks */
  word-break: break-word;
  overflow-wrap: anywhere;
  margin: 0;
  padding: 8px 12px;
  /* inner padding for readability */
}

/* Ensure all elements inside the result area wrap and respect padding so text
   never touches the right edge. Apply box-sizing so padding is included in width. */
.result,
.result-section,
.result-detail,
.result * {
  box-sizing: border-box;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
  /* allow wrapping */
}

/* Give the inner light-highlight block extra right padding to avoid touching the border */
.result-section {
  padding-right: 20px;
}

/* Slightly increase padding for the inner detail block */
.result-detail {
  padding-right: 12px;
}

.result-detail h3 {
  color: #5a4230;
  margin: 0 0 16px;
  font-size: 1.3rem;
  border-bottom: 2px solid #a67c52;
  padding-bottom: 8px;
}

.result-section {
  background-color: #f9f6f3;
  padding: 12px;
  margin: 12px 0;
  border-left: 4px solid #a67c52;
  border-radius: 4px;
}

.result-section h4 {
  color: #5a4230;
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.result-section p {
  margin: 6px 0;
  color: #333;
}

.price-breakdown {
  list-style: none;
  padding: 0;
  margin: 8px 0;
}

.price-breakdown li {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  color: #5a4230;
}

.price-breakdown .price {
  font-weight: bold;
  color: #a67c52;
}

.result-section .total {
  font-size: 1.05rem;
  color: #5a4230;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #ecdccc;
}

.result-summary {
  background: linear-gradient(135deg, #f5f0ec, #e8d8c4);
  padding: 16px;
  margin-top: 16px;
  border-radius: 6px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 1.05rem;
  color: #5a4230;
}

.summary-row.total-row {
  font-size: 1.2rem;
  font-weight: bold;
}

.price-highlight {
  color: #a67c52;
  font-size: 1.1rem;
}

.price-highlight.total {
  color: #8c6646;
  font-size: 1.4rem;
}

/* สไตล์ dropdown ที่เพิ่มใหม่ */
select#partitionHeightType {
  width: 100%;
  box-sizing: border-box;
  padding: 8px;
  border: 1px solid #ecdccc;
  border-radius: 6px;
  background-color: #fff;
  margin-bottom: 8px;
}

.layout-grid {
  display: flex;
  flex-direction: column;
}

.layout-grid form {
  flex: 1;
}

.layout-grid .result {
  flex: 1;
}

/* บนมือถือ (<1024px) ซ่อน inline result เพราะใช้ modal แทน */
@media (max-width: 1023px) {
  .layout-grid .result {
    display: none;
  }

  /* Show material calculate button only on mobile */
  button#mat_calculateBtn {
    display: block;
  }
}

@media (min-width: 1024px) {
  .layout-grid {
    flex-direction: row;
    align-items: flex-start;
    gap: 32px;
  }

  /* User requested layout: form 40% / result 60% on desktop */
  .layout-grid form {
    flex: 1 1 40%;
    min-width: 360px;
    /* prevent the form column from collapsing too small when content updates */
  }

  .layout-grid .result {
    flex: 1 1 60%;
    min-width: 520px;
    /* keep result readable and avoid sudden reflow */
    margin-top: 0;
    position: sticky;
    top: 24px;
  }

  button#calculateBtn {
    display: none;
  }

  /* Ensure material calculate button is hidden on desktop */
  button#mat_calculateBtn {
    display: none;
  }

  button#shippingCalculateMobileBtn {
    display: none;
  }
}

/* ===== Modal styles (mobile only) ===== */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal.show {
  display: block;
}

.modal-content {
  background-color: #ffffff;
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  border-radius: 0;
  /* needed so the spinner overlay can be absolutely positioned inside */
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: linear-gradient(135deg, #f5f0ec, #e8d8c4);
  border-bottom: 2px solid #a67c52;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.2rem;
  color: #5a4230;
  flex: 1;
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  color: #5a4230;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-actions {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  background-color: #fffaf4;
  border-bottom: 1px solid #ecdccc;
}

/* Make modal action buttons show icon and label side-by-side (like the Share button)
   This ensures Save and Copy buttons on mobile keep the same icon+text layout
   even after desktop button-size adjustments. */
.modal-actions .action-btn {
  flex-direction: row;
  justify-content: center;
  align-items: center;
  white-space: nowrap;
  /* keep icon and label on one line */
  padding: 10px 12px;
}

.modal-actions .action-btn svg {
  width: 20px;
  height: 20px;
}

.action-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px;
  background-color: #ffffff;
  border: 1px solid #d5c5b3;
  border-radius: 6px;
  color: #5a4230;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.action-btn:hover,
.action-btn:active {
  background-color: #f5eee8;
  border-color: #a67c52;
}

.action-btn svg {
  color: #a67c52;
}

/* Generic checkable button styles for modal and desktop */
.action-btn .btn-check {
  display: none;
}

.action-btn.checking .btn-label {
  display: none;
}

.action-btn.checking .btn-check {
  display: inline-flex;
}

.action-btn .btn-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.action-btn .btn-check svg {
  width: 18px;
  height: 18px;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background-color: #ffffff;
}

/* Spinner overlay when capturing modal content */
.modal-spinner {
  position: absolute;
  inset: 0;
  /* top:0; right:0; bottom:0; left:0 */
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.85);
  z-index: 1100;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.modal-spinner.visible {
  visibility: visible;
  opacity: 1;
}

.modal-spinner .spinner {
  width: 48px;
  height: 48px;
  border: 6px solid #f3f3f3;
  border-top: 6px solid #a67c52;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Disabled state for action buttons while capturing */
.action-btn.disabled,
.action-btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Desktop result actions (appear at top-right inside .result) */
.result-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
  z-index: 50;
}

.result-actions .action-btn {
  padding: 4px 6px;
  font-size: 0.6rem;
  /* ~50% smaller */
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.result-actions .action-btn {
  /* ensure icon + text are on a single row and do not wrap */
  flex-direction: row;
  white-space: nowrap;
}

.result-actions .action-btn svg {
  width: 14px;
  height: 14px;
}

/* Make sure the label inside the button keeps icon and text aligned in one line */
.result-actions .action-btn .btn-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

/* checkmark state: hide label and show check icon */
.result-actions .action-btn .btn-check {
  display: none;
}

.result-actions .action-btn.checking .btn-label {
  display: none;
}

.result-actions .action-btn.checking .btn-check {
  display: inline-flex;
}

/* Spinner overlay for desktop result */
.result-spinner {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.9);
  z-index: 9999;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.result-spinner.visible {
  visibility: visible;
  opacity: 1;
}

.result-spinner .spinner {
  width: 40px;
  height: 40px;
  border: 5px solid #f3f3f3;
  border-top: 5px solid #a67c52;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Hide modal on desktop */
@media (min-width: 1024px) {
  .modal {
    display: none !important;
  }
}

/* แถว 8 ฟิลบน PC */
.partition-row-8 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  /* default บนจอไม่ใหญ่มาก */
  gap: 12px;
}

/* แถว 2 ฟิลด้านล่าง */
.partition-row-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

/* ย่อ label ให้สั้นและตัวเล็กลง */
.partition-compact .input-group label {
  font-size: 0.85rem;
  white-space: nowrap;
}

/* จอใหญ่กว้าง ๆ → 8 ฟิลในแถวเดียว */
@media (min-width: 1200px) {
  .partition-row-8 {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }
}

/* จอเล็กลง → หักเป็น 2 ฟิล/แถว */
@media (max-width: 960px) {
  .partition-row-8 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .partition-row-2 {
    grid-template-columns: 1fr;
  }
}

/* partition preview adjustments */
#partitionPreview {
  width: 100%;
  min-height: 620px;
  height: 620px;
}

/* Mobile portrait: make partition preview + controls stack vertically and touch friendly */
@media (max-width: 480px) {

  /* Stack preview and side panel */
  .partition-preview-row {
    display: flex !important;
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }

  /* Make preview shorter and full-width for mobile portrait */
  #partitionPreview {
    height: 420px;
    min-height: 320px;
    border-radius: 6px;
  }

  /* Side panel becomes full-width and sits below the preview */
  .partition-side-panel {
    flex: none !important;
    width: 100% !important;
    max-width: none !important;
    order: 2;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  /* Ensure preview container is on top */
  #partitionPreview {
    order: 1;
  }

  /* Inputs stack to single column and enlarge hit area */
  .partition-row-8 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px;
  }

  .partition-row-2 {
    grid-template-columns: 1fr !important;
  }

  .partition-compact .input-group label {
    font-size: 0.95rem;
    white-space: normal;
  }

  /* Bigger form controls for touch */
  .partition-top input[type="number"],
  .partition-top input[type="text"],
  .partition-top select {
    padding: 10px 12px;
    font-size: 1rem;
  }

  /* Touch-friendly action buttons in side panel */
  .partition-side-panel .action-btn,
  .partition-side-panel button {
    padding: 10px 12px;
    font-size: 1rem;
  }

  /* Reduce visual density of preview actions panel */
  .preview-actions-panel {
    padding: 12px;
  }

  /* Prevent overflow by allowing vertical scroll inside result area */
  .partition-bottom.result {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ปิดการ select ข้อความ + บังคับเคอร์เซอร์ใน preview */
#partitionPreview svg {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
}

/* กลุ่ม element ที่เป็นช่อง (มี data-cell-index) ให้เป็นเคอร์เซอร์แบบคลิกได้ */
#partitionPreview [data-cell-index] {
  cursor: pointer;
}

/* กันกรณี text/tspan ยังโดน select */
#partitionPreview text,
#partitionPreview tspan {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
}

#partitionPreview [data-cell-index].cell-selected circle {
  fill: #fff7e0;
  stroke-width: 2px;
}

#partitionPreview [data-cell-index].cell-selected text {
  font-weight: 600;
}

/* ========== LASER TAB – Compact Layout ========== */

/* หัวข้อแท็บเลเซอร์ */
.tab-content[data-content="laser"] h1 {
  font-size: 1.1rem;
  margin-bottom: 10px;
  color: #5a4230;
}

/* ครอบทั้งหมดของฟอร์ม+slots */
.laser-top {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ===== SLOT CARD (single line compact) ===== */

.laser-slot-card {
  background-color: #fffdf8;
  border: 1px solid #e4d6c7;
  border-radius: 6px;
  padding: 8px 12px;
  box-sizing: border-box;
  margin-bottom: 10px;
}

.laser-slot-card-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  /* ระยะห่างระหว่าง content กับปุ่ม + − */
}

/* โซนซ้าย: จุดที่ 1 + ไฟล์ + ฟิลด์ */
.laser-slot-main {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  /* ให้เส้นล่างตรงกัน */
  gap: 16px;
  flex: 1;
}

/* ป้าย “จุดที่ 1” */
.laser-slot-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: #5a4230;
  margin-right: 6px;
  min-width: 65px;
}

/* ปุ่มเลือกไฟล์ (inline) */
.laser-slot-file-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 28px;
  min-width: 150px;
}

/* ปุ่มเลือกไฟล์แบบ custom */
.laser-slot-card .ksp-file-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 12px;
  border-radius: 4px;
  border: 1px solid #d6c7b7;
  background: #ffffff;
  font-size: 0.82rem;
  color: #5a4230;
  cursor: pointer;
  min-width: 0;
}

.laser-slot-card .ksp-file-btn span {
  white-space: nowrap;
}

/* ซ่อน input file จริง ให้คลิกทั้งปุ่มแทน */
.laser-slot-card .ksp-file-btn input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* ฟิลด์ 4 ตัว เรียงกัน */
.laser-slot-fields-inline {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 12px;
}

.laser-slot-fields-inline .input-group {
  display: flex;
  flex-direction: column;
  min-width: 120px;
}

.laser-slot-fields-inline label {
  font-size: 0.75rem;
  margin-bottom: 2px;
}

.laser-slot-fields-inline input,
.laser-slot-fields-inline select {
  padding: 5px 8px;
  font-size: 0.82rem;
  border: 1px solid #d6c7b7;
  border-radius: 4px;
}

/* ปรับความสูง/เส้นล่างเท่ากัน */
.laser-slot-fields-inline input,
.laser-slot-fields-inline select,
.laser-slot-card .ksp-file-btn {
  height: 32px;
  box-sizing: border-box;
  padding-top: 4px;
  padding-bottom: 4px;
  font-size: 0.82rem;
}

/* ปุ่ม + − */
.laser-slot-card-controls {
  display: flex;
  flex-direction: row;
  gap: 6px;
}

.laser-slot-card-controls button {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid #d5c5b3;
  background-color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  color: #8c755e;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: 0.15s;
}

.laser-slot-card-controls button:hover {
  background-color: #a67c52;
  border-color: #8c6646;
  color: #fff;
  transform: translateY(-1px);
}

/* ===== Responsive – slot card ===== */

@media (max-width: 900px) {
  .laser-slot-main {
    flex-wrap: wrap;
  }

  .laser-slot-fields-inline {
    flex-wrap: wrap;
  }
}

@media (max-width: 600px) {
  .laser-slot-card-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .laser-slot-card-controls {
    align-self: flex-end;
  }
}

/* ========== LASER – Top rows (project + box size + slot list) ========== */

.laser-row {
  background-color: #ffffff;
  border: 1px solid #e4d6c7;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
  box-sizing: border-box;
}

/* 1.1 โปรเจกต์ + ขนาดกล่อง → อยู่บรรทัดเดียวกันบน PC */
.laser-row-project {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

/* กล่องชื่อโปรเจกต์ (ตัวแรกในแถว) */
.laser-row-project>div:first-child {
  flex: 1.6 1 220px;
  max-width: none !important;
  margin: 0 !important;
}

/* กลุ่มขนาดกล่อง (W/L/H) */
.laser-box-size-group {
  flex: 1.2 1 260px;
  display: flex;
  gap: 8px;
  margin: 0;
  flex-wrap: nowrap;
}

.laser-box-size-group .input-group {
  flex: 1 1 0;
}

.laser-box-size-group label {
  display: block;
  font-size: 0.75rem;
  margin-bottom: 2px;
  color: #6d5446;
}

.laser-box-size-group input[type="number"] {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #e6d8cc;
  border-radius: 4px;
  font-size: 0.8rem;
  box-sizing: border-box;
}

/* input ชื่อโปรเจกต์ให้ใช้สไตล์เดียวกัน */
.laser-row-project input#projectNameLaser {
  padding: 6px 8px !important;
  font-size: 0.85rem;
}

/* 1.2 แถวรายการจุดยิงเลเซอร์ */

.laser-row-slots {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.laser-slot-list-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.laser-slot-list-header h2 {
  margin: 0;
  font-size: 1rem;
  color: #5a4230;
}

.laser-slot-list-header .note {
  margin: 0;
  font-size: 0.75rem;
  color: #8c755e;
}

/* list ของการ์ด slot (ตอน JS เติม) */
.laser-slot-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ปุ่มเพิ่มจุดยิง → ชิดซ้าย */
.laser-slot-actions {
  margin-top: 6px;
  text-align: left;
}

/* ปุ่มหลักแบบกระชับ */
.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  font-size: 0.8rem;
  cursor: pointer;
  background-color: #a67c52;
  color: #fff;
  transition: background-color 0.2s ease, transform 0.08s ease;
}

.primary-btn:hover {
  background-color: #8c6646;
  transform: translateY(-1px);
}

.primary-btn:active {
  transform: translateY(0);
}

/* ========== LASER – Preview + Tools ========== */

.laser-middle {
  margin-top: 12px;
}

.laser-bottom {
  margin-top: 8px;
}

/* section ที่จะเติมแถว preview แต่ละ slot */
.laser-preview-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 1 แถวต่อ 1 จุดยิง: พรีวิวใหญ่ซ้าย – 6 โลโก้กลาง – tools ขวา */
.laser-slot-row {
  background-color: #ffffff;
  border: 1px solid #e4d6c7;
  border-radius: 8px;
  padding: 10px 12px;
  box-sizing: border-box;
}

.laser-slot-row-header h3 {
  margin: 0 0 6px;
  font-size: 0.9rem;
  color: #5a4230;
}

/* layout สามคอลัมน์หลัก */
.laser-slot-row-body {
  display: grid;
  grid-template-columns: 3.0fr 0.55fr 0.75fr;
  gap: 10px;
  align-items: stretch;
}

/* พรีวิวด้านกล่อง */
.laser-main-preview {
  background-color: #fffdf8;
  border-radius: 6px;
  border: 1px solid #ecdccc;
  padding: 6px;
  box-sizing: border-box;
}

.laser-main-preview-inner {
  width: 100%;
  height: 480px;
  min-height: 480px;
  background-color: #fdf7f1;
  border-radius: 4px;
  border: 1px dashed #d4c3b3;
  overflow: hidden;
}

/* Ensure SVG previews expand to fill their container */
.laser-preview-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* พาแนลตัวอย่างโลโก้ 6 แบบ (คอลัมน์กลาง) */
.laser-variant-panel {
  background-color: #fffdf8;
  border-radius: 6px;
  border: 1px solid #ecdccc;
  padding: 6px;
  box-sizing: border-box;
}

.laser-variant-panel h4 {
  margin: 0 0 8px;
  font-size: 0.9rem;
  color: #6d5446;
  text-align: center;
}

.laser-variant-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  /* Lock to exactly 7 items visible. Each item is 110px tall. There are 6 gaps between 7 items. */
  max-height: calc(4 * 110px + 6 * 4px);
  min-height: calc(4 * 110px + 6 * 4px);
  overflow-y: auto;
  box-sizing: border-box;
}

.laser-variant-item {
  position: relative;
  border-radius: 4px;
  border: 1px solid #e4d6c7;
  background-color: #ffffff;
  padding: 3px;
  cursor: pointer;
  overflow: hidden;
  /* Fixed height so grid math is predictable */
  height: 110px;
  box-sizing: border-box;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.laser-variant-item img {
  max-width: 100%;
  max-height: 56px;
  display: block;
}

/* active state ให้ตรงกับ JS (.is-active) */
.laser-variant-item.is-active {
  border-color: #a67c52;
  box-shadow: 0 0 0 2px rgba(166, 124, 82, 0.2);
}

/* Copy button for variant items */
.laser-variant-copy-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid #d6c7b7;
  background: rgba(255, 255, 255, 0.95);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease, background-color 0.2s ease, transform 0.1s ease;
  z-index: 10;
  padding: 0;
}

.laser-variant-item:hover .laser-variant-copy-btn {
  opacity: 1;
}

.laser-variant-copy-btn:hover {
  background-color: #f5eee8;
  border-color: #a67c52;
  transform: scale(1.05);
}

.laser-variant-copy-btn:active {
  transform: scale(0.95);
}

.laser-variant-copy-btn svg {
  width: 14px;
  height: 14px;
  color: #5a4230;
}

/* Checkmark state for copy button */
.laser-variant-copy-btn .btn-label {
  display: inline-flex;
}

.laser-variant-copy-btn .btn-check {
  display: none;
}

.laser-variant-copy-btn.checking {
  opacity: 1;
  background-color: #4caf50;
  border-color: #4caf50;
}

.laser-variant-copy-btn.checking .btn-label {
  display: none;
}

.laser-variant-copy-btn.checking .btn-check {
  display: inline-flex;
}

.laser-variant-copy-btn.checking svg {
  color: #fff;
}

/* พาแนล tools คอลัมน์ขวา */
.laser-tools-panel {
  background-color: #fffdf8;
  border-radius: 6px;
  border: 1px solid #ecdccc;
  padding: 6px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.laser-tools-panel h4 {
  margin: 0 0 6px;
  font-size: 0.9rem;
  color: #6d5446;
  text-align: center;
}

/* Anchor 3x3 */
.laser-anchor-grid {
  margin-top: 4px;
  display: grid;
  grid-template-columns: repeat(3, 22px);
  gap: 4px;
  justify-content: center;
}

.laser-anchor-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid #d5c5b3;
  background-color: #fff;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  color: #8c755e;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    transform 0.08s ease;
}

/* active state ให้ตรงกับ JS (.is-active) */
.laser-anchor-btn.is-active {
  background-color: #a67c52;
  border-color: #8c6646;
  color: #fff;
  transform: translateY(-1px);
}

/* Offset 4 ทิศ */
.laser-offset-grid {
  margin-top: 6px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.laser-offset-group label {
  display: block;
  font-size: 0.7rem;
  margin-bottom: 2px;
  color: #7a604a;
}

.laser-offset-group input[type="number"] {
  width: 100%;
  box-sizing: border-box;
  padding: 3px 5px;
  border-radius: 4px;
  border: 1px solid #e0d1c1;
  font-size: 0.75rem;
}

/* ปุ่ม tools */
.laser-tools-actions {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.laser-tools-actions .action-btn {
  justify-content: center;
  font-size: 0.78rem;
  padding: 5px 8px;
}

/* ========== LASER – Summary ด้านล่าง (ต่อจาก preview) ========== */

.laser-summary {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.9fr);
  gap: 10px;
}

.laser-summary-box {
  background-color: #fffdf8;
  border-radius: 8px;
  border: 1px solid #e4d6c7;
  padding: 8px 10px;
  box-sizing: border-box;
}

.laser-summary-box h3 {
  margin: 0 0 4px;
  font-size: 0.9rem;
  color: #5a4230;
}

#laserBoxSummaryText {
  margin: 0;
  font-size: 0.8rem;
  color: #6d5446;
}

#laserSlotsSummary {
  font-size: 0.78rem;
  color: #6d5446;
  line-height: 1.35;
}

#laserSlotsSummary .laser-summary-side {
  margin-bottom: 6px;
}

#laserSlotsSummary .laser-summary-side-title {
  font-weight: 600;
  margin-bottom: 1px;
}

/* ========== Responsive (จอเล็ก) ========== */

@media (max-width: 1024px) {
  .laser-slot-row-body {
    grid-template-columns: 1fr;
  }

  .laser-summary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .laser-row-project {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .laser-row-project>div:first-child {
    margin-bottom: 0 !important;
    flex: none !important;
    width: 100% !important;
  }

  .laser-box-size-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    flex: none;
  }

  .laser-box-size-group .input-group:last-child {
    grid-column: 1 / -1;
  }

  .laser-row {
    padding: 8px;
  }

  .laser-main-preview-inner {
    height: 280px;
    min-height: 280px;
  }
}

/* ========== Live Search Results Dropdown ========== */
.live-search-results {
  display: none;
  position: absolute;
  z-index: 1000;
  background-color: #f9f6f3;
  border: 1px solid #ecdccc;
  max-height: 200px;
  overflow-y: auto;
  border-radius: 6px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.live-search-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid #ecdccc;
  background-color: #f9f6f3;
  color: #5a4230;
  transition: background-color 0.15s ease;
}

.live-search-item:last-child {
  border-bottom: none;
}

.live-search-item:hover {
  background-color: #ecdccc;
}