/* --- 1. Phân tích và Tư vấn chung --- */
/* Import Font chữ */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@600;700&family=Roboto:wght@400;500&display=swap');

/* Biến màu chủ đạo */
:root {
    --color-primary: #4CAF50;
    /* Xanh lá cây */
    --color-primary-dark: #388E3C;
    --color-accent: #FF9800;
    /* Vàng/Cam */
    --color-text: #333333;
    /* Màu chữ chính */
    --color-text-light: #666666;
    /* Màu chữ phụ */
    --color-bg: #FFFFFF;
    /* Màu nền trắng */
    --color-bg-light: #f9f9f9;
    /* Màu nền xám nhạt */
    --font-family-base: 'Roboto', sans-serif;
    --font-family-heading: 'Montserrat', sans-serif;
}

/* --- Cài đặt Global --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family-base);
    color: var(--color-text);
    background-color: var(--color-bg);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

a {
    text-decoration: none;
    color: var(--color-primary);
    transition: color 0.3s ease;
}

a:hover {
    color: var(--color-primary-dark);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-family-heading);
    color: var(--color-text);
    margin-bottom: 1rem;
}

h2.section-title {
    text-align: center;
    font-size: 2.2rem;
    margin-bottom: 40px;
    text-transform: uppercase;
}

/* --- 3.A. Phần chung (Header & Footer) --- */
/* Header */
.site-header {
    background-color: var(--color-bg);
    border-bottom: 1px solid #eee;
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease-in-out;
    /* Cho hiệu ứng cuộn */
}

/* Class JS thêm vào khi cuộn xuống */
.site-header.header-hidden {
    transform: translateY(-100%);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.site-logo img {
    height: 50px;
}

/* Menu chính */
.main-navigation ul {
    list-style: none;
    display: flex;
    gap: 25px;
}

.main-navigation li {
    position: relative;
}

.main-navigation a {
    color: var(--color-text);
    font-weight: 500;
    padding: 10px 5px;
    text-transform: uppercase;
    font-size: 0.9rem;
}

/* Gạch chân menu item active (trừ mobile items) */
.main-navigation li:not(.mobile-only-item) a:hover,
.main-navigation li.current-menu-item:not(.mobile-only-item) a {
    color: var(--color-primary);
    border-bottom: 2px solid var(--color-primary);
}

/* Menu con (Dropdown) */
.main-navigation .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--color-bg);
    min-width: 200px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    border-radius: 0 0 5px 5px;
    padding: 10px 0;
}

.main-navigation li:hover>.sub-menu {
    display: block;
}

.main-navigation .sub-menu li {
    width: 100%;
}

.main-navigation .sub-menu a {
    display: block;
    padding: 8px 15px;
    border-bottom: none;
}

.main-navigation .sub-menu a:hover {
    background-color: var(--color-bg-light);
}

/* Header bên phải */
.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-cta-button {
    background-color: var(--color-primary);
    color: #fff;
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: 600;
    white-space: nowrap;
}

.header-cta-button:hover {
    background-color: var(--color-primary-dark);
    color: #fff;
}

/* Footer */
.site-footer {
    background-color: #2c2c2c;
    color: #f0f0f0;
    padding: 50px 0 20px 0;
    margin-top: 50px;
}

.footer-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
}

.footer-column .footer-logo img {
    height: 60px;
    margin-bottom: 15px;
}

.footer-column p {
    font-size: 0.9rem;
    color: #ccc;
    line-height: 1.7;
}

.footer-column h4 {
    font-family: var(--font-family-heading);
    color: #fff;
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.footer-column ul {
    list-style: none;
}

.footer-column ul li {
    margin-bottom: 10px;
}

.footer-column ul a {
    color: #ccc;
    text-decoration: none;
}

.footer-column ul a:hover {
    color: var(--color-accent);
    padding-left: 5px;
}

.footer-bottom {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #444;
    font-size: 0.85rem;
    color: #aaa;
}

/* --- 3.B. Trang chủ (Homepage) --- */
/* Hero Slider */
.hero-slider {
    position: relative;
    height: 500px;
    overflow: hidden;
    background-color: #f0f0f0;
}

.hero-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #fff;
    opacity: 0;
    visibility: hidden;
    transition: opacity 1s ease-in-out;
}

.hero-slide::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
}

.hero-slide.active {
    opacity: 1;
    visibility: visible;
}

.hero-content {
    position: relative;
    z-index: 2;
}

/* Sửa lỗi duplicate: chỉ giữ 1 định nghĩa */
.hero-content .slogan {
    font-size: 2.8rem;
    font-weight: 700;
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.5);
    margin-bottom: 20px;
    color: #FFFFFF;
}

.hero-content .cta-button {
    background-color: var(--color-accent);
    color: #fff;
    padding: 12px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 30px;
    text-transform: uppercase;
}

.hero-content .cta-button:hover {
    background-color: #e68900;
}

/* Giới thiệu & Cam kết */
.intro-commitment-section {
    padding: 60px 0;
    background-color: var(--color-bg);
}

.intro-commitment-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
}

.intro-content h2 {
    font-size: 2rem;
    margin-bottom: 15px;
}

.intro-content p {
    color: var(--color-text-light);
    margin-bottom: 20px;
}

.commitments-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.commitment-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background-color: var(--color-bg-light);
    border-radius: 8px;
    border-left: 5px solid var(--color-primary);
}

.commitment-item .icon {
    font-size: 2.5rem;
    color: var(--color-primary);
}

.commitment-item h5 {
    font-size: 1.1rem;
    margin: 0;
}

/* Danh mục sản phẩm (Trang chủ) */
.category-section {
    padding: 60px 0;
    background-color: var(--color-bg-light);
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
}

.category-item {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.category-item a {
    display: block;
}

.category-item img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.category-item .category-name {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    color: #fff;
    padding: 30px 20px 20px;
    font-size: 1.5rem;
    font-family: var(--font-family-heading);
    font-weight: 600;
    text-align: center;
}

.category-item:hover img {
    transform: scale(1.1);
}

/* Sản phẩm nổi bật & Lưới sản phẩm chung */
.featured-products-section {
    padding: 60px 0;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
}

.product-card {
    background-color: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.product-card:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(-5px);
}

.product-image {
    width: 100%;
    height: 220px;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-info {
    padding: 20px;
}

.product-name {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.product-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 15px;
}

.product-button {
    display: block;
    width: 100%;
    text-align: center;
    background-color: var(--color-primary-dark);
    color: #fff;
    padding: 10px;
    border-radius: 5px;
    font-weight: 500;
}

.product-button:hover {
    background-color: var(--color-accent);
    color: #fff;
}

/* Khu vực Chứng nhận (Trang chủ) */
.certification-section {
    padding: 60px 0;
    background-color: var(--color-bg-light);
    text-align: center;
}

.certification-logos {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
    margin-bottom: 25px;
}

.cert-logo img {
    height: 100px;
    opacity: 0.8;
    filter: grayscale(50%);
    transition: opacity 0.3s, filter 0.3s;
}

.cert-logo img:hover {
    opacity: 1;
    filter: grayscale(0%);
}

.certification-section p {
    max-width: 700px;
    margin: 0 auto 30px auto;
    color: var(--color-text-light);
}

.certification-button {
    background-color: transparent;
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
    padding: 10px 25px;
    border-radius: 25px;
    font-weight: 600;
}

.certification-button:hover {
    background-color: var(--color-primary);
    color: #fff;
}

/* --- 3.C. Trang Danh mục Sản phẩm --- */
.page-header {
    padding: 40px 0;
    background-color: var(--color-bg-light);
    text-align: center;
    margin-bottom: 40px;
}

.page-header h1 {
    font-size: 2.5rem;
    margin: 0;
}

.category-description {
    text-align: center;
    max-width: 800px;
    margin: -20px auto 40px auto;
    color: var(--color-text-light);
}

.category-page-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
}

/* Sidebar (Bộ lọc) */
.sidebar .widget {
    margin-bottom: 30px;
    border: 1px solid #eee;
    border-radius: 5px;
}

.sidebar .widget-title {
    font-size: 1.2rem;
    padding: 15px;
    background-color: var(--color-bg-light);
    border-bottom: 1px solid #eee;
    margin: 0;
}

.sidebar .widget-content {
    padding: 15px;
}

.sidebar .widget-content ul {
    list-style: none;
}

.sidebar .widget-content li {
    margin-bottom: 8px;
}

.sidebar .widget-content a {
    color: var(--color-text-light);
}

.sidebar .widget-content a:hover {
    color: var(--color-accent);
}

/* Lưới sản phẩm chính (Trang danh mục) */
.main-content .product-grid {
    grid-template-columns: repeat(3, 1fr);
}

/* --- 3.D. Trang Chi tiết Sản phẩm --- */
.product-detail-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    padding-top: 40px;
}

/* Thư viện ảnh */
.product-gallery .main-image img {
    width: 100%;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 15px;
}

.product-thumbnails {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.product-thumbnails .thumb-item img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border: 1px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    opacity: 0.7;
}

.product-thumbnails .thumb-item.active img,
.product-thumbnails .thumb-item:hover img {
    opacity: 1;
    border-color: var(--color-primary);
}

/* Thông tin chi tiết */
.product-details .product-title {
    font-size: 2.3rem;
    font-weight: 700;
}

.product-details .product-price {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 20px;
}

.product-details .short-description {
    font-size: 1.1rem;
    color: var(--color-text-light);
    margin-bottom: 25px;
    line-height: 1.7;
}

.product-info-list {
    list-style: none;
    margin-bottom: 30px;
    padding-left: 0;
    /* Đảm bảo ko bị thụt lề */
}

.product-info-list li {
    font-size: 1rem;
    margin-bottom: 10px;
    color: var(--color-text);
}

.product-info-list li strong {
    min-width: 100px;
    display: inline-block;
    color: var(--color-text);
}

.product-cta-button {
    display: inline-block;
    background-color: var(--color-accent);
    color: #fff;
    font-size: 1.2rem;
    padding: 15px 40px;
    border-radius: 30px;
    font-weight: 600;
    text-transform: uppercase;
}

.product-cta-button:hover {
    background-color: #e68900;
    color: #fff;
}

/* Tabs mô tả chi tiết */
/* Sửa lỗi typo: product_tabs -> product-tabs */
.product-tabs {
    margin-top: 60px;
    border-top: 1px solid #eee;
    padding-top: 30px;
}

.tab-nav {
    display: flex;
    gap: 20px;
    border-bottom: 2px solid #eee;
    margin-bottom: 20px;
}

.tab-link {
    font-size: 1.2rem;
    font-weight: 600;
    padding: 10px 20px;
    cursor: pointer;
    color: var(--color-text-light);
    border-bottom: 3px solid transparent;
}

.tab-link.active {
    color: var(--color-text);
    border-bottom-color: var(--color-primary);
}

.tab-content {
    display: none;
    padding: 20px 0;
    line-height: 1.8;
}

.tab-content.active {
    display: block;
}

/* Sản Phẩm Tương Tự (Trang Chi Tiết) */
.related-products-section {
    padding: 60px 0;
    margin-top: 40px;
    background-color: var(--color-bg-light);
    border-top: 1px solid #eee;
}

/* Sửa lỗi conflict: Cho nó 4 cột trên desktop giống mặc định */
.related-products-section .product-grid {
    grid-template-columns: repeat(4, 1fr);
}

/* --- Trang Chứng Nhận --- */
.certification-page-section {
    padding: 60px 0;
}

.cert-gallery {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
}

.cert-item {
    border: 1px solid #eee;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cert-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}

/* Ảnh chứng nhận lớn */
.cert-item>a>img {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: 8px 8px 0 0;
    border-bottom: 1px solid #eee;
}

.cert-item h4 {
    font-size: 1.25rem;
    color: var(--color-text);
    padding: 15px 20px 5px 20px;
    margin: 0;
}

.cert-item p {
    font-size: 0.95rem;
    color: var(--color-text-light);
    padding: 0 20px 20px 20px;
}

/* Gallery ảnh nhỏ bên trong 1 item */
/* Gallery ảnh nhỏ bên trong 1 item */
.cert-gallery-inner {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    /* 5 cột là đúng rồi */
    gap: 5px;
    padding: 10px;
}

/* Ảnh xét nghiệm nhỏ */
.cert-item .cert-gallery-inner img {
    width: 100%;
    /* THAY ĐỔI Ở ĐÂY: Dùng ảnh vuông 1:1 */
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 5px;
    border: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    /* Ghi đè CSS cũ */
}

/* --- Menu Di động & Header Mobile --- */
.mobile-menu-toggle {
    display: none;
    background-color: transparent;
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
    font-size: 1.5rem;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
}

.mobile-only-item {
    display: none;
}

/* ============================================== */
/* === Responsive - Tablet (Dưới 992px) === */
/* ============================================== */
@media (max-width: 992px) {

    .container,
    .header-container {
        padding: 0 20px;
    }

    /* Header & Menu */
    .main-navigation {
        display: none;
        position: absolute;
        top: 71px;
        left: 0;
        width: 100%;
        background-color: var(--color-bg);
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    }

    .main-navigation.is-open {
        display: block;
    }

    .main-navigation ul {
        flex-direction: column;
        gap: 0;
    }

    .main-navigation li {
        width: 100%;
        border-bottom: 1px solid #eee;
    }

    .main-navigation .sub-menu {
        position: static;
        box-shadow: none;
        padding-left: 20px;
    }

    .header-right {
        display: none;
    }

    .mobile-menu-toggle {
        display: block;
        order: 3;
    }

    .header-container {
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .main-navigation.is-open .mobile-only-item {
        display: block;
        border-top: 1px solid #f0f0f0;
    }

    .mobile-search {
        padding: 15px;
        background: #f9f9f9;
    }

    .mobile-search:hover {
        background: #f9f9f9;
    }

    .search-form-mobile {
        display: flex;
        border: 1px solid #ccc;
        border-radius: 5px;
        overflow: hidden;
    }

    .search-form-mobile input {
        border: none;
        outline: none;
        padding: 10px;
        width: 100%;
        font-family: var(--font-family-base);
    }

    .search-form-mobile button {
        border: none;
        background: var(--color-primary);
        color: white;
        padding: 0 12px;
        cursor: pointer;
    }

    .header-cta-button-mobile {
        display: block;
        background-color: var(--color-primary);
        color: #fff;
        text-align: center;
        padding: 12px;
        font-weight: 600;
        margin: 15px;
        border-radius: 5px;
    }

    .header-cta-button-mobile:hover {
        background-color: var(--color-primary-dark);
        color: #fff;
    }

    /* Layout chung */
    .footer-container {
        grid-template-columns: 1fr 1fr;
    }

    .intro-commitment-grid,
    .category-page-layout,
    .product-detail-layout {
        grid-template-columns: 1fr;
    }

    /* Lưới sản phẩm (2 cột) */
    .category-grid,
    .product-grid,
    .main-content .product-grid {
        grid-template-columns: 1fr 1fr;
    }

    .related-products-section .product-grid {
        grid-template-columns: 1fr 1fr;
    }

    /* Sản phẩm tương tự 2 cột */
    .sidebar {
        margin-bottom: 30px;
    }

    /* Gallery chứng nhận (2 cột) */
    .cert-gallery {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================== */
/* === Responsive - Mobile (Dưới 576px) === */
/* ============================================== */
/* Sửa lỗi: Gộp các khối 576px lại */
@media (max-width: 576px) {

    /* Tiêu đề */
    h2.section-title {
        font-size: 1.8rem;
    }

    /* Ẩn nút desktop không cần thiết */
    .header-cta-button {
        display: none;
    }

    /* Slider */
    .hero-content .slogan {
        font-size: 2rem;
    }

    /* Layout chung (1 cột) */
    .footer-container,
    .commitments-list,
    .cert-gallery {
        grid-template-columns: 1fr;
    }

    /* Lưới sản phẩm (1 cột) */
    .category-grid,
    .product-grid,
    .main-content .product-grid,
    .related-products-section .product-grid {
        grid-template-columns: 1fr;
    }

    /* Sửa lỗi conflict: chỉ giữ 1 cột */
    /* Chứng nhận */
    .certification-logos {
        gap: 20px;
    }

    .cert-logo img {
        height: 80px;
    }

    /* Chi tiết sản phẩm */
    .product-details .product-title {
        font-size: 1.8rem;
    }

    .product-details .product-price {
        font-size: 1.5rem;
    }

    .tab-link {
        font-size: 1rem;
        padding: 8px 10px;
    }
}