/* ============================================================
   modern.css — ปรับแต่งหน้าเว็บให้ดูโมเดิร์น (shadow + animation)
   โหลดหลัง style.css เพื่อ override โดยไม่แก้ไฟล์เดิม
   ============================================================ */

:root {
    --m-shadow: 0 6px 18px rgba(17, 24, 39, 0.08);
    --m-shadow-hover: 0 16px 38px rgba(17, 24, 39, 0.16);
    --m-radius: 16px;
    --m-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Card ทุกชนิด: เงา + มุมโค้ง + ทรานสิชัน ---------- */
.product-item,
.product-offer,
.cat-item,
.card {
    border-radius: var(--m-radius);
    box-shadow: var(--m-shadow);
    transition: transform 0.45s var(--m-ease), box-shadow 0.45s var(--m-ease);
    will-change: transform;
    overflow: hidden;
}

.product-item {
    border: 0 !important;
}

/* ยกการ์ดขึ้นเมื่อ hover */
.product-item:hover,
.product-offer:hover,
.cat-item:hover,
.card:hover {
    transform: translateY(-8px);
    box-shadow: var(--m-shadow-hover);
}

/* ---------- รูปภาพในการ์ด: ซูมนุ่ม ๆ เมื่อ hover ---------- */
.product-img {
    transition: transform 0.7s var(--m-ease);
}
.product-item:hover .product-img {
    transform: scale(1.08);
}

.product-offer img,
.cat-item img {
    transition: transform 0.7s var(--m-ease);
}
.product-offer:hover img {
    transform: scale(1.06);
}

/* ---------- ปุ่ม action ที่ลอยบนรูป: เฟดเข้าเนียน ---------- */
.product-action {
    transition: opacity 0.4s var(--m-ease);
}

/* ---------- ปุ่มทั่วไป: ทรานสิชัน + ยกเล็กน้อยเมื่อ hover ---------- */
.btn {
    transition: transform 0.25s var(--m-ease), box-shadow 0.25s var(--m-ease),
                background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease !important;
}
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(17, 24, 39, 0.15);
}
.btn:active {
    transform: translateY(0);
}

/* ---------- กล่องตัวกรอง / กล่องพื้นอ่อน ใช้เป็นการ์ด ---------- */
.bg-light.p-4 {
    border-radius: var(--m-radius);
    box-shadow: var(--m-shadow);
    transition: box-shadow 0.4s var(--m-ease);
}
.bg-light.p-4:hover {
    box-shadow: 0 10px 26px rgba(17, 24, 39, 0.12);
}

/* ---------- Pagination โมเดิร์น ---------- */
.pagination .page-link {
    border: 0;
    margin: 0 4px;
    border-radius: 12px !important;
    color: #374151;
    transition: transform 0.25s var(--m-ease), background-color 0.25s ease, color 0.25s ease;
}
.pagination .page-link:hover {
    transform: translateY(-2px);
}
.pagination .page-item.active .page-link {
    box-shadow: 0 6px 16px rgba(17, 24, 39, 0.18);
}

/* ---------- หัวข้อ section: ขีดเส้นใต้เคลื่อนไหว ---------- */
.section-title span {
    transition: letter-spacing 0.4s var(--m-ease);
}

/* ---------- แถบเมนู: ลิงก์มีเส้นใต้ค่อย ๆ ยืด ---------- */
.navbar .nav-link {
    position: relative;
    transition: color 0.3s ease;
}
.navbar .nav-link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 6px;
    width: 100%;
    height: 2px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.35s var(--m-ease);
    opacity: 0.85;
}
.navbar .nav-link:hover::after,
.navbar .nav-link.active::after {
    transform: scaleX(1);
}

/* ---------- ปุ่มกลับขึ้นบน ---------- */
.back-to-top {
    transition: transform 0.3s var(--m-ease), box-shadow 0.3s var(--m-ease), opacity 0.3s ease;
    box-shadow: 0 8px 20px rgba(17, 24, 39, 0.2);
}
.back-to-top:hover {
    transform: translateY(-4px);
}

/* ============================================================
   Scroll reveal — ค่อย ๆ ปรากฏเมื่อเลื่อนถึง (เพิ่มโดย modern.js)
   ============================================================ */
.reveal-init {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.7s var(--m-ease), transform 0.7s var(--m-ease);
    will-change: opacity, transform;
}
.reveal-init.reveal-in {
    opacity: 1;
    transform: none;
}

/* โหลดตัวแรก ๆ ให้ไล่กันเป็นจังหวะ (stagger) */
.reveal-init.d1 { transition-delay: 0.05s; }
.reveal-init.d2 { transition-delay: 0.12s; }
.reveal-init.d3 { transition-delay: 0.19s; }
.reveal-init.d4 { transition-delay: 0.26s; }

/* ============================================================
   ตัวเลือกภาษาแบบธงชาติ (แทนปุ่ม "เลือกภาษา" ของ Google Translate)
   ============================================================ */

/* ซ่อน widget เดิมของ Google แต่คงไว้ในหน้าเพื่อขับการแปลเบื้องหลัง */
#google_translate_element {
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    height: 0 !important;
    overflow: hidden !important;
}

.lang-switcher {
    position: relative;
    display: inline-block;
    text-align: left;
}

.flag {
    width: 24px;
    height: 18px;
    object-fit: cover;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    vertical-align: middle;
    flex: 0 0 auto;
}

/* ปุ่มธงปัจจุบัน */
.lang-current {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid rgba(132, 1, 115, 0.3);
    border-radius: 50px;
    padding: 6px 12px;
    cursor: pointer;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s var(--m-ease);
}
.lang-current:hover {
    border-color: rgb(132, 1, 115);
    box-shadow: 0 4px 12px rgba(132, 1, 115, 0.18);
    transform: translateY(-1px);
}
.lang-current .fa-caret-down {
    color: rgb(132, 1, 115);
    font-size: 12px;
    transition: transform 0.3s var(--m-ease);
}
.lang-switcher.open .lang-current .fa-caret-down {
    transform: rotate(180deg);
}

/* เมนูธง */
.lang-menu {
    list-style: none;
    margin: 8px 0 0;
    padding: 6px;
    position: absolute;
    right: 0;
    top: 100%;
    min-width: 180px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 16px 38px rgba(17, 24, 39, 0.18);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.25s var(--m-ease), transform 0.25s var(--m-ease), visibility 0.25s;
    z-index: 1000;
}
.lang-switcher.open .lang-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-menu li { margin: 0; }
.lang-menu .lang-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 10px;
    color: #374151 !important;
    font-size: 14px;
    text-decoration: none !important;
    transition: background-color 0.2s ease, transform 0.2s var(--m-ease);
}
.lang-menu .lang-opt:hover {
    background: rgba(132, 1, 115, 0.08);
    transform: translateX(3px);
}
.lang-menu .lang-opt.active {
    background: rgba(132, 1, 115, 0.12);
    font-weight: 600;
}

/* ซ่อนแถบ/กรอบที่ Google Translate แทรกเข้ามา ไม่ให้ดันหน้าเว็บ */
.goog-te-banner-frame.skiptranslate,
.skiptranslate iframe { display: none !important; }
body { top: 0 !important; }

/* ============================================================
   เคารพผู้ใช้ที่ตั้งค่า "ลดการเคลื่อนไหว"
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .product-item, .product-offer, .cat-item, .card,
    .product-img, .btn, .bg-light.p-4, .back-to-top,
    .reveal-init {
        transition: none !important;
        transform: none !important;
    }
    .reveal-init { opacity: 1 !important; }
}
