/* ======================================================================
   layout.css
   PURPOSE:
   - Global layout styles shared across ALL pages
   - Used by: home.html, about.html, product.html
   - Includes: header, navigation, footer, global animation
   IMPORTANT:
   - Editing this file WILL affect every page using base layout
   ====================================================================== */


/* [SECTION 0] GLOBAL RESET & BASE STYLE */

html {
    -webkit-text-size-adjust: 100%;
    height: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

main {
    flex: 1 0 auto;
}

footer {
    flex-shrink: 0;
}


/* [SECTION 1] HEADER & NAVBAR (GLOBAL)*/

header {
    padding: 10px 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1001;
    background: none;
    box-shadow: none;
    transition: all 0.4s ease;
}

header.scrolled {
    background: rgba(255, 255, 255, 0.95) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2) !important;
}

header.transparent {
    background: none !important;
    box-shadow: none !important;
}

/* [SECTION 2] LOGO */
.logo img {
    height: 50px;
    padding-left: 100px;
}

/* [SECTION 3] NAVIGATION CONTAINER*/
nav {
    display: flex;
    align-items: center;
    width: 100%;
    margin-right: 50px;
}

/* [SECTION 4] MAIN NAV LINKS */
.nav-links {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-left: auto;
    margin-right: auto;
}

.nav-links a.nav-item {
    position: relative;
    text-decoration: none;
    color: #000000;
    font-size: 16px;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-links a .nav-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    transition: transform 0.3s ease;
    filter: none;
}

.nav-links a.nav-item:hover .nav-icon,
.nav-links a.nav-item.active .nav-icon {
    filter: brightness(0) saturate(100%) invert(21%) sepia(79%) saturate(2641%) hue-rotate(335deg) brightness(91%) contrast(92%);
}

.nav-links a span {
    display: inline-block;
}

.nav-links a.nav-item::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -22px;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #c41e3a, #e63946);
    transform: translateX(-50%);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.nav-links a:hover {
    margin-top: 2px;
    color: #c41e3a;
    transform: translateY(-2px);
}

.nav-links a:hover .nav-icon {
    transform: scale(1.15);
    filter: brightness(0) saturate(100%) invert(21%) sepia(79%) saturate(2641%) hue-rotate(335deg) brightness(91%) contrast(92%);
}

.nav-links a:hover::after {
    width: 80%;
    height: 4px;
}

.nav-links a:active {
    transform: translateY(0);
    color: #c41e3a;
    font-weight: 600;
}

.nav-links a.active .nav-icon {
    transform: scale(1.15);
    filter: brightness(0) saturate(100%) invert(21%) sepia(79%) saturate(2641%) hue-rotate(335deg) brightness(91%) contrast(92%);
}

/* [SECTION 5] RIGHT NAV ICONS (LANGUAGE) */
.nav-icons {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 0px;
}

.icon-circle {
    width: 34px;
    height: 34px;
    border: #3e3e3e 1px solid;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #000000;
    margin: 0 4px;
    cursor: pointer;
    position: relative;
    transition: background-color 0.3s, border-color 0.3s;
}

.icon-circle-inner {
    overflow: hidden;
    width: 100%;
    height: 100%;
    display: flex;
    border-radius: 50%;
    justify-content: center;
    align-items: center;
}

.icon-circle.language-selector:hover:not(:has(.lang-dropdown:hover)) .lang-text {
    animation: toTopFromBottom 0.3s forwards;
}

.icon-circle:hover {
    border-color: #666;
}

.icon-circle i {
    font-size: 14px;
    position: relative;
    z-index: 1;
}

.icon-circle:hover i {
    animation: toTopFromBottom 0.3s forwards;
}

@keyframes toTopFromBottom {
    49% {
        transform: translateY(-100%);
    }

    50% {
        opacity: 0;
        transform: translateY(100%);
    }

    51% {
        opacity: 1;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* [SECTION 6] LANGUAGE DROPDOWN */
.lang-dropdown {
    position: absolute;
    top: 40px;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    min-width: 200px;
    max-height: 300px;
    overflow-y: auto;
}

.dropdown-grid {
    display: flex;
    flex-direction: column;
    padding: 8px;
    gap: 2px;
}

.lang-dropdown a {
    display: block;
    padding: 10px 16px;
    color: #1f2937;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.lang-dropdown:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(2px);
}

.lang-dropdown a:hover {
    background-color: #f3f4f6;
    color: #c41e3a;
}

.lang-dropdown a.active {
    background-color: #c41e3a;
    color: white;
}

.lang-dropdown a.active:hover {
    background-color: #c41e3a;
}

.language-selector:hover .lang-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(2px);
}

/* [SECTION 7] PRODUCT DROPDOWN (NAV) */
.nav-item-dropdown {
    position: relative;
    display: inline-block;
}

.nav-item-dropdown .nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dropdown-arrow {
    font-size: 12px;
    margin-left: 4px;
    transition: transform 0.3s ease;
}

.nav-item-dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

.product-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    min-width: 220px;
    padding: 8px;
}

.nav-item-dropdown:hover .product-dropdown {
    opacity: 1;
    visibility: visible;
}

.product-dropdown .dropdown-item {
    display: block;
    padding: 12px 16px;
    color: #1f2937;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.product-dropdown .dropdown-item:hover {
    background-color: #f3f4f6;
    color: #c41e3a;
}

.product-dropdown .dropdown-item.active {
    background-color: #fee2e2;
    color: #c41e3a;
}

header.scrolled .product-dropdown {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

/* [SECTION 8] CONTACT BUTTON (NAV CTA) */
.contact-btn {
    background: #c41e3a;
    text-decoration: none;
    color: white !important;
    padding: 8px 20px;
    margin-left: 2px;
    border-radius: 25px;
    transition: background 0.3s;
}

.contact-btn:hover {
    background: #a01828;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: background 0.1s, transform 0.3s, box-shadow 0.3s;
}

/* [SECTION 9] FOOTER (GLOBAL) */
#contact {
    background: #1a1a1a;
    color: #ffffff;
    padding: 40px 20px 20px;
    width: 100%;
    box-sizing: border-box;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    max-width: 1200px;
    margin: 0 auto;
    gap: 40px;
    flex-wrap: wrap;
}

/* logo + tel */
.footer-left {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 0.8;
    margin-left: 100px;
    margin-top: 30px;
}

.footer-section {
    flex: 1;
    min-width: 200px;
}

.footer-logo-section {
    flex: unset;
    margin: 0;
}

.footer-contact {
    flex: unset;
}

.footer-info {
    flex: 1.2;
    margin-left: -20px;
    align-self: center;
}

.footer-logo {
    max-width: 200px;
    height: auto;
}

.footer-contact p,
.footer-info p {
    margin: 15px 0;
    font-size: 16px;
    line-height: 1.6;
}

.footer-divider {
    border: none;
    border-top: 1px solid #444;
    margin: 30px auto;
    max-width: 1200px;
}

.footer-menu {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
    margin: 20px 0;
}

.footer-menu a {
    color: #c41e3a;
    text-decoration: none;
    font-size: 16px;
    transition: color 0.3s;
}

.footer-menu a:hover {
    color: #fff;
}


/* [SECTION 10] HAMBURGER BUTTON*/
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 10px;
    z-index: 10002;
    margin-left: auto;
    background: none;
    border: none;
}

.hamburger span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: #ffffff;
    transition: all 0.3s ease;
    border-radius: 2px;
}

header.transparent .hamburger span {
    background-color: white;
}

header.scrolled .hamburger {
    z-index: 10001;
}

header.scrolled .hamburger span {
    background-color: #333;
}

.hamburger.active span {
    background-color: #333 !important;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 6px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -6px);
}


/* [SECTION 11] MOBILE SIDEBAR OVERLAY */
.nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1050;
    opacity: 0;
    background: rgba(0, 0, 0, 0.5);
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.nav-overlay.active {
    opacity: 1;
    pointer-events: all;
}


/* [SECTION 12] MOBILE SIDEBAR MENU*/
.mobile-sidebar {
    position: fixed;
    top: 0;
    right: -320px;
    width: 300px;
    max-width: 85vw;
    height: 100vh;
    background: #ffffff;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    padding: 0;
    box-shadow: -4px 0 30px rgba(0, 0, 0, 0.2);
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}

.mobile-sidebar.active {
    right: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 1;
}

.sidebar-logo img {
    height: 40px;
}

.sidebar-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
    color: #333;
    font-size: 20px;
    line-height: 1;
}

.sidebar-close:hover {
    background: #f3f4f6;
    color: #c41e3a;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 12px 16px;
    gap: 4px;
    flex: 1;
}

.sidebar-nav a,
.sidebar-nav .sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 10px;
    text-decoration: none;
    color: #1f2937;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.sidebar-nav a:hover,
.sidebar-nav .sidebar-nav-item:hover {
    background: #f9f9f9;
    color: #c41e3a;
}

.sidebar-nav a.active,
.sidebar-nav .sidebar-nav-item.active {
    background: #fee2e2;
    color: #c41e3a;
    font-weight: 600;
}

.sidebar-nav .nav-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.sidebar-submenu {
    display: none;
    flex-direction: column;
    gap: 2px;
    padding: 4px 0 4px 44px;
}

.sidebar-submenu.open {
    display: flex;
}

.sidebar-submenu a {
    font-size: 14px;
    padding: 10px 14px;
    color: #4b5563;
}

.sidebar-submenu a:hover {
    color: #c41e3a;
    background: #f3f4f6;
}

.sidebar-divider {
    border: none;
    border-top: 1px solid #f0f0f0;
    margin: 8px 16px;
}

.sidebar-contact-btn {
    margin: 16px 16px 8px;
    padding: 14px 20px;
    background: #c41e3a;
    color: white !important;
    text-decoration: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    transition: background 0.2s;
    display: block;
}

.sidebar-contact-btn:hover {
    background: #a01828;
}

.sidebar-lang-section {
    padding: 16px 20px;
    border-top: 1px solid #f0f0f0;
}

.sidebar-lang-label {
    font-size: 12px;
    color: #9ca3af;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 10px;
}

.sidebar-lang-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.sidebar-lang-options a {
    text-decoration: none;
    color: #374151;
    font-weight: 500;
    font-size: 14px;
    padding: 6px 16px;
    border: 1.5px solid #d1d5db;
    border-radius: 20px;
    transition: all 0.2s;
}

.sidebar-lang-options a:hover {
    border-color: #c41e3a;
    color: #c41e3a;
}

.sidebar-lang-options a.active {
    background: #c41e3a;
    color: #fff;
    border-color: #c41e3a;
}


/* [SECTION 13] DESKTOP  */
.desktop-only {
    display: block;
}

.mobile-only {
    display: none;
}

.mobile-lang-section {
    display: none;
}

.mobile-sidebar {
    display: none;
}

.sidebar-close-btn {
    display: none !important;
}

.nav-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1050;
    opacity: 0;
    background: rgba(0, 0, 0, 0.5);
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.nav-overlay.active {
    display: block;
    opacity: 1;
    pointer-events: all;
}


/* [SECTION 14] RESPONSIVE */
@media (max-width: 1500px) {

    .nav-links,
    .nav-icons .icon-circle,
    .desktop-only {
        display: none !important;
    }

    .hamburger {
        display: flex;
        margin-right: 40px;
        z-index: 10000;
    }

    header {
        padding: 10px;
        justify-content: space-between;
    }

    .logo {
        flex-shrink: 0;
    }

    .logo img {
        padding-left: 30px;
        height: 40px;
    }

    nav {
        margin-right: 0;
        justify-content: flex-end;
    }

    .nav-links {
        display: flex !important;
        flex-direction: column;
        position: fixed;
        top: 0;
        right: -320px;
        width: 300px;
        max-width: 85vw;
        height: 100vh;
        background: #ffffff;
        z-index: 9999;
        padding: 80px 20px 30px;
        gap: 6px;
        box-shadow: -4px 0 30px rgba(0, 0, 0, 0.15);
        overflow-y: auto;
        transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        margin-left: 0;
        margin-right: 0;
    }

    .nav-links.active {
        right: 0;
    }

    .nav-links a.nav-item {
        width: 100%;
        padding: 14px 16px;
        border-radius: 10px;
        font-size: 15px;
        color: #1f2937;
    }

    .nav-links a.nav-item::after {
        display: none;
    }

    .nav-links a.nav-item:hover,
    .nav-links a.nav-item.active {
        background: #fee2e2;
        color: #c41e3a;
        transform: none;
        margin-top: 0;
    }

    .nav-item-dropdown {
        width: 100%;
    }

    .nav-item-dropdown:hover .product-dropdown,
    .nav-item-dropdown .product-dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        box-shadow: none;
        padding: 4px 0 4px 40px;
        min-width: unset;
    }

    .product-dropdown .dropdown-item {
        font-size: 14px;
        padding: 10px 14px;
        color: #4b5563;
    }

    .contact-btn.mobile-only {
        display: block !important;
        text-align: center;
        margin-top: 8px;
        padding: 14px 20px;
        border-radius: 12px;
        font-size: 15px;
        font-weight: 600;
    }

    .mobile-lang-section {
        display: block;
        padding: 20px 16px 8px;
        border-top: 1px solid #b8b8b8;
        margin-top: 8px;
    }

    .lang-label {
        font-size: 11px;
        font-weight: 700;
        color: #272727;
        text-transform: uppercase;
        letter-spacing: 0.1em;
        margin-bottom: 12px;
        display: block;
    }

    .mobile-lang-options {
        display: flex;
        gap: 10px;
    }

    .lang-opt {
        text-decoration: none;
        color: #374151;
        font-weight: 600;
        font-size: 14px;
        padding: 8px 20px;
        border: 1.5px solid #e5e7eb;
        border-radius: 999px;
        transition: all 0.2s ease;
        background: #f9fafb;
    }

    .lang-opt:hover {
        border-color: #c41e3a;
        color: #c41e3a;
        background: #fff1f2;
    }

    .lang-opt.active {
        background: #c41e3a;
        color: #ffffff;
        border-color: #c41e3a;
        box-shadow: 0 2px 8px rgba(196, 30, 58, 0.35);
    }

    .sidebar-close-btn {
        display: flex;
        position: absolute;
        top: 16px;
        right: 16px;
        width: 36px;
        height: 36px;
        border: none;
        background: #f3f4f6;
        border-radius: 50%;
        cursor: pointer;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        color: #6b7280;
        transition: all 0.2s ease;
        z-index: 1300;
    }

    .sidebar-close-btn:hover {
        background: #fee2e2;
        color: #c41e3a;
    }

    .nav-overlay {
        display: block;
        pointer-events: none;
    }

    .nav-overlay.active {
        pointer-events: all;
    }
}

/* [SECTION 16] products page, nav text/icons are white before scrolling */
.products-page-header:not(.scrolled) .nav-links a.nav-item {
    color: #ffffff;
}

.products-page-header:not(.scrolled) .nav-links a.nav-item:hover {
    color: #ffffff;
    opacity: 0.85;
}

.products-page-header:not(.scrolled) .nav-links a.nav-item::after {
    background: linear-gradient(90deg, #ffffff, #ffffff);
}

/* White nav icons (Home, About, Services) */
.products-page-header:not(.scrolled) .nav-links a.nav-item .nav-icon {
    filter: brightness(0) invert(1);
}

/* Active product icon — keep red */
.products-page-header:not(.scrolled) .nav-links a.nav-item.active .nav-icon {
    filter: brightness(0) saturate(100%) invert(21%) sepia(79%) saturate(2641%) hue-rotate(335deg) brightness(91%) contrast(92%);
}

/* White language circle border + text */
.products-page-header:not(.scrolled) .icon-circle {
    border-color: #ffffff;
}

.products-page-header:not(.scrolled) #current-lang-text {
    color: #ffffff;
}

/* White hamburger */
.products-page-header:not(.scrolled) .hamburger span {
    background-color: #ffffff;
}

@media (max-width: 800px) {
    .hamburger {
        margin-right: 20px;
    }
    .footer-content {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
        gap: 10px 20px;
        padding: 0 10px;
        max-width: 100%;
    }

    .footer-logo-section {
        grid-column: 1;
        grid-row: 1;
        margin-left: 0;
        margin-top: 0;
        display: flex;
        align-items: flex-end;
    }

    .footer-logo {
        max-width: 130px;
    }

    .footer-contact {
        grid-column: 1;
        grid-row: 2;
    }

    .footer-contact p {
        font-size: 12px;
        margin: 0;
    }

    /* ✅ แยก footer-info เป็น 2 p ให้แต่ละ p อยู่คนละ row */
    .footer-info {
        grid-column: 2;
        grid-row: 1 / 3;
        margin-left: 0;
        text-align: left;
        display: grid;
        grid-template-rows: auto auto;
        align-content: stretch;
    }

    .footer-info p {
        font-size: 12px;
        margin: 0;
        display: flex;
        align-items: flex-end;
        /* ✅ ทั้งคู่ชิดล่างของ row ตัวเอง */
    }

    .footer-info p:last-child {
        align-items: flex-start;
        /* ✅ address ชิดบนของ row 2 */
    }

    .footer-menu {
        gap: 15px;
    }

    .footer-menu a {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .footer-content {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
        gap: 8px 12px;
        padding: 0 5px;
        max-width: 100%;
    }

    .footer-logo-section {
        grid-column: 1;
        grid-row: 1;
        margin-left: 0;
        margin-top: 0;
        display: flex;
        align-items: flex-end;
    }

    .footer-logo {
        max-width: 90px;
    }

    .footer-contact {
        grid-column: 1;
        grid-row: 2;
    }

    .footer-contact p {
        font-size: 10px;
        margin: 0;
    }

    .footer-info {
        grid-column: 2;
        grid-row: 1 / 3;
        margin-left: 0;
        text-align: left;
        display: grid;
        grid-template-rows: auto auto;
        align-content: stretch;
    }

    .footer-info p {
        font-size: 10px;
        margin: 0;
        display: flex;
        align-items: flex-end;
    }

    .footer-info p:last-child {
        align-items: flex-start;
    }

    .footer-menu {
        gap: 10px;
        justify-content: center;
    }

    .footer-menu a {
        font-size: 11px;
    }
}

@media (max-width: 440px) {
    .footer-info p:last-child {
        align-items: flex-start;
        margin-right: 0;
    }
}