/* -----------------------------------------------------------------------------
 * custom.css — ส่วนที่ปรับเพิ่มจากธีมต้นฉบับ (assets/css/style.css)
 * โหลดต่อจาก style.css เสมอ เพื่อให้อัปเดตธีมทับได้โดยไม่เสียการแก้ไขนี้
 * -------------------------------------------------------------------------- */

/* topbar
 * ธีมต้นฉบับใช้รูปภาพปุ่ม (icon-tel-content.png) ที่ฝังเบอร์โทรไว้ในภาพ
 * จึงเปลี่ยนมาใช้ข้อความ + ไอคอน เพื่อให้เบอร์โทร/ไลน์ ดึงจากระบบหลังบ้านได้จริง */
.topbar-btn-text i {
    margin-right: 8px;
}

@media (max-width: 640px) {
    .topbar-links {
        gap: 8px;
    }

    .topbar a.topbar-btn .topbar-btn-text {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 42px;
        padding: 0 18px;
        border-radius: 999px;
        background: #0b57b5;
        color: #fff;
        font-weight: 700;
        font-size: 14.5px;
        white-space: nowrap;
    }

    .topbar a.topbar-btn--line .topbar-btn-text {
        background: #06c755;
    }
}

/* เมนู dropdown บนแถบเมนูหลัก (จอ ≥ 961px — ต่ำกว่านั้นธีมซ่อน .nav ไปใช้เมนูมือถือ)
 * ธีมเว้นช่องว่างโปร่งใสไว้ 2 จุด: .dd{margin-top:8px} และ .dd .sub{margin-left:8px}
 * ช่องว่างนี้ไม่ได้อยู่ในกล่องของ <li> เวลาเลื่อนเมาส์ข้ามไปหาเมนูย่อย :hover จึงหลุด
 * แล้วเมนูหายก่อนที่เมาส์จะไปถึง — ปูพื้นที่โปร่งใส (สะพาน) คลุมช่องว่างให้ hover ต่อเนื่อง
 * ความกว้าง/สูงเท่ากับ margin ของธีมพอดี จะได้ไม่ไปทับพื้นที่ hover ของเมนูตัวอื่น */
@media (min-width: 961px) {

    /* ชั้น 1: ช่องว่างใต้เมนูหลัก ↔ กล่อง .dd */
    .nav .dd::before {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        bottom: 100%;
        height: 8px;
    }

    /* ชั้น 2: ช่องว่างด้านซ้ายของ .sub ↔ ขอบขวาของรายการหมวดหลัก */
    .nav .dd .sub::before {
        content: "";
        position: absolute;
        top: 0;
        bottom: 0;
        right: 100%;
        width: 8px;
    }

    /* หน่วงเวลาก่อนปิด (grace period) — สะพานอย่างเดียวยังไม่พอ
     * เมนูย่อยชั้น 2 เริ่มที่ระดับเดียวกับหมวดหลัก รายการที่ 2 เป็นต้นไปจึงอยู่ "ต่ำกว่า" แถวของหมวดหลัก
     * เวลาเลื่อนเมาส์แนวทแยงไปหา เมาส์จะหลุดออกใต้ <li> ไปโดนหมวดถัดไปก่อนถึงเมนูย่อย
     * จึงคงเมนูไว้ 0.3 วิ หลัง hover หลุด ถ้าเมาส์ไปถึงเมนูย่อยทัน :hover จะกลับมาและยกเลิกการซ่อนเอง */
    .nav .dd .sub {
        /* ธีมไม่ได้ใส่ visibility ไว้ใน transition เมนูจึงหายทันทีที่ hover หลุด — เติมให้ครบก่อน */
        transition: opacity .16s ease .3s, transform .16s ease .3s, visibility .16s linear .3s;
    }

    .nav .dd li:hover .sub {
        /* ขาแสดงผลไม่ต้องหน่วง เปิดทันทีเหมือนเดิม */
        transition: opacity .16s ease, transform .16s ease, visibility .16s;
    }

    .nav li.has-dd .dd {
        transition-delay: .3s;
    }

    .nav li.has-dd:hover .dd {
        transition-delay: 0s;
    }
}

/* about-detail
 * เนื้อหา "ความเป็นมา" หน้าเกี่ยวกับเรา มาจากช่อง Detail (CKEditor) ในหลังบ้าน
 * จึงเป็น <p> / <ul> เปล่า ๆ ไม่มี class ของธีม — สไตล์ตรงนี้ทำให้หน้าตาเหมือน
 * .text-soft และ .feat-list ของธีมเดิม โดยผู้ดูแลระบบไม่ต้องเขียน markup เอง */
.about-detail p {
    color: var(--text-soft);
    margin-top: 14px;
}

.about-detail p:first-child {
    margin-top: 0;
}

.about-detail ul {
    list-style: none;
    padding: 0;
    margin-top: 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.about-detail ul li {
    position: relative;
    padding-left: 38px;
    font-size: 15.5px;
    min-height: 26px;
}

/* กล่องพื้นหลังไอคอน (เทียบเท่า .feat-list .ico) */
.about-detail ul li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 1px;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: var(--surface-tint);
}

/* เครื่องหมายถูก ใช้ mask เพื่อให้เปลี่ยนสีตามธีม light/dark ได้ */
.about-detail ul li::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 6px;
    width: 16px;
    height: 16px;
    background: var(--blue-ink);
    -webkit-mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12l5 5L20 6'/%3E%3C/svg%3E") center / 16px 16px no-repeat;
    mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12l5 5L20 6'/%3E%3C/svg%3E") center / 16px 16px no-repeat;
}

/* รูปแบนเนอร์หน้ารายละเอียดผลงาน ธีมมีแต่ rule ของ svg เลยต้องเติมของ img เอง */
.article-banner img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* การ์ดแกลเลอรี "ภาพบรรยากาศหน้างาน" — เหตุผลเดียวกับ .article-banner img
   (style.css ของธีมรุ่นใหม่มี rule นี้แล้ว แต่สำเนาในโปรเจกต์เก่ากว่า และห้ามแก้ style.css) */
.gallery-item img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* แผนที่หน้าติดต่อเรา
 * ธีมต้นฉบับวาดแผนที่ปลอม (พื้นหลังตาราง + หมุด svg) เปลี่ยนมาเป็น iframe ของ Google Maps
 * ที่ดึง URL จากตารางตั้งค่า (contact_google_map) จึงต้องเติม rule ของ iframe เอง */
.map-shell iframe {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ย้ายปุ่มไปมุมบนขวา ไม่ให้ทับปุ่มซูมของ Google ที่อยู่มุมล่างขวา */
.map-shell .map-link {
    top: 14px;
    bottom: auto;
    z-index: 2;
}

/* ยังไม่ได้ตั้งค่าแผนที่ในหลังบ้าน */
.map-shell .map-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}

/* ข้อความแจ้งเตือนใต้ช่องกรอกของฟอร์มหน้าเว็บ (ธีมไม่มี rule นี้)
   สี/ขนาด/น้ำหนักตัวอักษรอิงจาก #cf-captcha-error ของธีมต้นฉบับ จะได้เป็นชุดเดียวกัน */
.form-panel .field-error {
    display: block;
    margin-top: 6px;
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.5;
    color: #d1453b;
}

/* ช่องที่ validate ไม่ผ่าน — กรอบแดง + พื้นหลังจาง ๆ ให้เห็นคู่กับข้อความด้านล่าง
   ต้องเขียน :focus ทับด้วย ไม่งั้นพอคลิกเข้าไปแก้ กรอบจะกลับไปเป็นสีฟ้าของธีมทันที */
.field input.is-invalid,
.field select.is-invalid,
.field textarea.is-invalid {
    border-color: #d1453b;
    background: #fff7f6;
}

.field input.is-invalid:focus,
.field select.is-invalid:focus,
.field textarea.is-invalid:focus {
    border-color: #d1453b;
    box-shadow: 0 0 0 3px rgba(209, 69, 59, .14);
}

/* -----------------------------------------------------------------------------
 * กล่องแจ้ง "ส่งข้อมูลสำเร็จ" ของฟอร์มหน้าเว็บ (components/frontend/success-dialog)
 * ธีมมีแต่ toast มุมจอ ไม่มี modal แบบนี้ — ใช้ตัวแปรสี/เงา/มุมโค้งของธีมทั้งหมด
 * -------------------------------------------------------------------------- */
.sw-modal {
    position: fixed;
    inset: 0;
    z-index: 300; /* สูงกว่า .lightbox (200) และปุ่มแชทลอยของปลั๊กอินธีม */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease, visibility .2s ease;
}

.sw-modal.show {
    opacity: 1;
    visibility: visible;
}

.sw-modal-scrim {
    position: absolute;
    inset: 0;
    background: rgba(18, 38, 46, .55);
    backdrop-filter: blur(2px);
}

.sw-modal-box {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 38px 30px 30px;
    text-align: center;
    transform: translateY(10px) scale(.97);
    transition: transform .24s cubic-bezier(.2, .8, .3, 1);
}

.sw-modal.show .sw-modal-box {
    transform: none;
}

/* แถบสีหัวกล่อง ใช้โทนฟ้า-ส้มของธีม */
.sw-modal-box::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    border-radius: var(--radius) var(--radius) 0 0;
    background: linear-gradient(90deg, var(--blue) 0%, var(--blue-deep) 55%, var(--accent) 100%);
}

.sw-modal-x {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-faint);
    cursor: pointer;
    transition: background .18s ease, color .18s ease;
}

.sw-modal-x:hover {
    background: var(--surface-tint);
    color: var(--text);
}

.sw-modal-x svg {
    width: 18px;
    height: 18px;
}

/* วงกลมเครื่องหมายถูก + วงแหวนกระเพื่อมรอบเดียวตอนเปิด */
.sw-modal-mark {
    position: relative;
    width: 74px;
    height: 74px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--surface-tint);
    color: var(--blue);
}

.sw-modal-mark svg {
    width: 36px;
    height: 36px;
    stroke-dasharray: 30;
    stroke-dashoffset: 30;
}

.sw-modal.show .sw-modal-mark svg {
    animation: swModalCheck .42s .16s ease forwards;
}

.sw-modal-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--blue);
    opacity: 0;
}

.sw-modal.show .sw-modal-ring {
    animation: swModalRing .8s .16s ease-out;
}

@keyframes swModalCheck {
    to { stroke-dashoffset: 0; }
}

@keyframes swModalRing {
    0% { transform: scale(.85); opacity: .7; }
    100% { transform: scale(1.35); opacity: 0; }
}

.sw-modal-title {
    margin: 0 0 10px;
    font-family: var(--font-head);
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
}

.sw-modal-text {
    margin: 0;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-soft);
}

.sw-modal-actions {
    margin-top: 26px;
}

.sw-modal-actions .btn {
    width: 100%;
    justify-content: center;
}

/* ล็อกไม่ให้หน้าหลังกล่องเลื่อนตาม */
body.sw-modal-open {
    overflow: hidden;
}

@media (max-width: 480px) {
    .sw-modal-box {
        padding: 34px 22px 24px;
    }

    .sw-modal-title {
        font-size: 20px;
    }
}

/* เครื่องที่ตั้งค่าลดการเคลื่อนไหว — ให้ขึ้นมาเฉย ๆ ไม่ต้องมีอนิเมชัน */
@media (prefers-reduced-motion: reduce) {
    .sw-modal,
    .sw-modal-box {
        transition: none;
    }

    .sw-modal.show .sw-modal-mark svg,
    .sw-modal.show .sw-modal-ring {
        animation: none;
    }

    .sw-modal .sw-modal-mark svg {
        stroke-dashoffset: 0;
    }
}

/* เวทีของป๊อปอัพดูรูปแกลเลอรี ธีมมีแต่ rule ของ svg (การ์ดปลอมเป็น gradient+svg)
   เลยต้องเติมของ img เอง — contain เพื่อให้เห็นรูปเต็มใบ ไม่โดนครอบตัด */
.lightbox-stage img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ตัวเลือกใน <select> ที่ข้อความยาว (ชื่อหมวดสินค้าจาก CMS) ทำให้ min-content ของกริดกว้างตาม
   จอ 390px จะเลื่อนแนวนอนได้ — ปลด min-width ของแต่ละชั้นแล้วบังคับให้ select กว้างเท่ากล่อง */
.split > *,
.contact-split > *,
.form-grid > *,
.field {
    min-width: 0;
}

.field select {
    width: 100%;
    max-width: 100%;
}

/* ปฏิทิน flatpickr ของฟอร์มนัดสำรวจหน้างาน — js เขียนปีบนหัวปฏิทินเป็น พ.ศ. ทับไว้
   จึงต้องปิดปุ่มเพิ่ม/ลดปี ไม่ให้เลข พ.ศ. ย้อนกลับเข้า flatpickr (จะกระโดดไป 543 ปี)
   เปลี่ยนปีใช้ลูกศรเดือนแทน */
.flatpickr-current-month .numInputWrapper {
    pointer-events: none;
}

/* =========================================================================
   หน้ารายละเอียดสินค้า — แกลเลอรีใต้บล็อกแรก + แท็บ "รายละเอียดสินค้า"
   ลอกมาจากไฟล์ธีม (assets/css/style.css รุ่นใหม่ + <style> ที่ฝังในหน้าสินค้า)
   ธีมฝัง <style> ก้อนนี้ซ้ำในไฟล์สินค้าทั้ง 28 หน้า รวบมาไว้ที่นี่ที่เดียว
   ========================================================================= */

/* -- แกลเลอรีรูปสินค้า (style.css ของธีมรุ่นใหม่มีแล้ว แต่สำเนาในโปรเจกต์ยังไม่มี
      และห้ามแก้ style.css จึงเขียนไว้ที่นี่) -- */
.prod-gallery-sec {
    padding: 20px 0 48px;
}

.flex-box {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.flex-box > div {
    flex: 0 0 auto;
}

.flex-box img {
    width: 130px;
    height: 130px;
    object-fit: contain;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    padding: 14px;
}

.flex-box--col {
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.flex-box--col img {
    width: auto;
    max-width: 820px;
    height: auto;
    border: none;
    border-radius: 14px;
    padding: 0;
    background: transparent;
}

.mw-100 {
    max-width: 100%;
}

/* -- ปุ่มแท็บ -- */
.ptabs {
    max-width: 960px;
    margin: 0 auto;
}

.ptabs-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin: 0 auto 30px;
    padding-bottom: 2px;
}

.ptabs-btn {
    appearance: none;
    cursor: pointer;
    font-family: inherit;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-soft);
    font-size: 16px;
    font-weight: 600;
    padding: 11px 20px;
    border-radius: 999px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    transition: all .2s ease;
}

.ptabs-btn .num {
    font-size: 12px;
    font-weight: 800;
    color: var(--blue-ink);
    background: var(--surface-tint);
    border-radius: 6px;
    padding: 3px 7px;
    transition: all .2s ease;
}

.ptabs-btn:hover {
    border-color: var(--blue);
    color: var(--text);
}

.ptabs-btn[aria-selected="true"] {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
    box-shadow: 0 10px 24px -12px color-mix(in srgb, var(--blue) 70%, transparent);
}

.ptabs-btn[aria-selected="true"] .num {
    background: rgba(255, 255, 255, .22);
    color: #fff;
}

.ptabs-panel {
    display: none;
    animation: ptabsFade .35s ease;
}

.ptabs-panel.is-active {
    display: block;
}

@keyframes ptabsFade {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

.ptabs-panel .panel-lead {
    text-align: center;
    max-width: 680px;
    margin: 0 auto 26px;
    color: var(--text-soft);
}

/* ตารางสเปคอยู่บนพื้นเทาของ section--alt จึงต้องให้ช่องค่าเป็นสีขาว */
.ptabs-panel .spec-table td {
    background: var(--surface);
}

/* -- เนื้อหาแบบการ์ดเรียงลง (layout = list) -- */
.plist {
    max-width: 820px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.plist-row {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    transition: border-color .2s ease, box-shadow .2s ease;
}

.plist-row:hover {
    border-color: var(--blue);
    box-shadow: var(--shadow-md);
}

/* แบบกรอบเดียวยาว คั่นแต่ละแถวด้วยเส้น */
.plist--boxed {
    gap: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.plist--boxed .plist-row {
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    border-bottom: 1px solid var(--border);
    padding: 20px 22px;
}

.plist--boxed .plist-row:last-child {
    border-bottom: none;
}

.plist--boxed .plist-row:hover {
    background: var(--surface-tint);
    box-shadow: none;
}

.plist-row .pl-ico {
    width: 40px;
    height: 40px;
    flex: none;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-tint);
}

.plist-row .pl-ico svg {
    width: 21px;
    height: 21px;
    stroke: var(--blue-ink);
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.plist-row .pl-body h4 {
    font-size: 16.5px;
    color: var(--text);
    margin: 0 0 4px;
}

.plist-row .pl-body p {
    font-size: 14.5px;
    color: var(--text-soft);
    margin: 0;
    line-height: 1.6;
}

/* -- เนื้อหาแบบรายการติ๊กถูก (layout = check) -- */
.pcheck {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    max-width: 820px;
    margin: 0 auto;
    list-style: none;
    padding: 0;
}

.pcheck li {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    font-size: 15px;
    color: var(--text);
    line-height: 1.55;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow: var(--shadow);
    transition: border-color .2s ease, box-shadow .2s ease;
}

.pcheck li:hover {
    border-color: var(--blue);
    box-shadow: var(--shadow-md);
}

.pcheck--boxed {
    gap: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
    padding: 8px 20px;
}

.pcheck--boxed li {
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    padding: 14px 4px;
}

.pcheck--boxed li:hover {
    border-color: transparent;
    box-shadow: none;
    color: var(--blue-deep);
}

.pcheck li svg {
    width: 20px;
    height: 20px;
    flex: none;
    margin-top: 2px;
    stroke: var(--accent);
    fill: none;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@media (max-width:560px) {
    .ptabs-btn { font-size: 13.5px; padding: 10px 15px; }
    .pcheck { grid-template-columns: 1fr; }
}
