/* Layout fixes on top of theme-home-09.css */

/* Danh mục (slider 2): ảnh cùng tỉ lệ, cột trái cao bằng cột phải */
section[data-animated-id="2"] .card img {
    width: 100%;
    object-fit: cover;
}
section[data-animated-id="2"] .col-md-6 .card img {
    aspect-ratio: 1 / 1;
    height: auto;
}
section[data-animated-id="2"] .col-12 .card img {
    aspect-ratio: 690 / 330;
    height: auto;
}
@media (min-width: 992px) {
    section[data-animated-id="2"] > .row > .col-lg-6:first-child .card,
    section[data-animated-id="2"] > .row > .col-lg-6:first-child .card img {
        height: 100%;
    }
}
@media (max-width: 991.98px) {
    section[data-animated-id="2"] > .row > .col-lg-6:first-child .card img {
        aspect-ratio: 1 / 1;
        height: auto;
    }
}

/* Nút tiêu đề trên ảnh danh mục */
section[data-animated-id="2"] .card-img-overlay .btn {
    box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
}

/* Danh mục chăm sóc (slider 7): lớp phủ để chữ trắng dễ đọc */
.card-img-overlay:has(> h3.card-title) {
    background: linear-gradient(to top, rgba(0, 0, 0, .55) 0%, rgba(0, 0, 0, .15) 45%, rgba(0, 0, 0, 0) 70%);
}
.card-img-overlay > h3.card-title {
    text-shadow: 0 2px 8px rgba(0, 0, 0, .35);
}

/* Ảnh sản phẩm: cùng khung 3:4 */
.card-product .card-img-top img {
    aspect-ratio: 3 / 4;
    object-fit: cover;
    background: #f5f5f5;
}

/* Tên sản phẩm tối đa 2 dòng để các thẻ thẳng hàng */
.card-product .product-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.8em;
}

/* Mạng xã hội: căn giữa khi ít ô hơn số cột */
#content section.bg-section-2 .slick-slider:not(.main):not(.thumb) .slick-track {
    margin-left: auto;
    margin-right: auto;
}
#content section.bg-section-2 .slick-slide a {
    overflow: hidden;
}
#content section.bg-section-2 .slick-slide a > span.bg-light {
    background: #fff !important;
    border: 1px solid rgba(0, 0, 0, .06);
    letter-spacing: .05em;
    transition: background-color .2s, color .2s;
}
#content section.bg-section-2 .slick-slide a:hover > span.bg-light {
    background: var(--bs-primary, #2e7d32) !important;
    color: #fff !important;
}

/* Review khách hàng: chữ vừa phải, không tràn */
.custom-arrow .slick-slide p.fs-3 {
    font-size: 1.375rem !important;
    line-height: 1.6;
}

/* Nội dung trang (page.php / page-full.php): ảnh không tràn màn hình */
main.layout-page img,
.wpb_wrapper img,
.entry-content img {
    max-width: 100%;
    height: auto;
}
main.layout-page iframe,
.wpb_wrapper iframe {
    max-width: 100%;
}

/* Template Full-Page: chữ nằm trong khung đọc, ảnh vẫn full-width */
main.layout-page > :is(h1, h2, h3, h4, h5, h6, p, ul, ol, table, blockquote, figure, .wp-block-table) {
    max-width: 1140px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 16px;
    padding-right: 16px;
}
main.layout-page > p:has(> img:only-child) {
    max-width: none;
    padding: 0;
}
main.layout-page > img {
    display: block;
    width: 100%;
    max-height: 80vh;
    object-fit: cover;
    margin-bottom: 3rem;
}
main.layout-page > :is(h2, h3) {
    margin-top: 2.5rem;
    margin-bottom: 1.25rem;
}
main.layout-page > p {
    line-height: 1.8;
}
main.layout-page > :last-child {
    margin-bottom: 5rem;
}

/* Popup tìm kiếm: logo đủ lớn, có nút đóng */
#searchModal .search-modal-logo img {
    height: 64px;
    width: auto;
    max-width: none;
}
#searchModal .search-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: auto;
}
#searchModal .search-modal-close .btn-close {
    padding: .75rem;
    opacity: .6;
}
#searchModal .search-modal-close .btn-close:hover {
    opacity: 1;
}
@media (min-width: 1200px) {
    #searchModal .search-modal-close {
        position: static;
        width: 25%;
    }
}
#searchModal .form-control {
    height: 52px;
    border-radius: 999px;
    padding-left: 1.5rem;
}

/* ===== Mobile ===== */
html, body {
    overflow-x: hidden;
}
@media (max-width: 1199.98px) {
    /* Logo header gọn lại */
    #header .navbar-brand img {
        width: auto;
        height: 64px;
    }
    #header .navbar-brand {
        padding-top: .25rem !important;
        padding-bottom: .25rem !important;
    }
    #header .main-header {
        padding-top: .5rem !important;
        padding-bottom: .5rem !important;
    }
}
@media (max-width: 767.98px) {
    /* Lưới sản phẩm 2 cột */
    .card-product .card-img-top {
        margin-bottom: 1rem !important;
    }
    .card-product .product-title {
        font-size: 13px !important;
        line-height: 1.4;
    }
    section .row.gy-11 {
        --bs-gutter-y: 2rem;
        --bs-gutter-x: 1rem;
    }

    /* Khối giới thiệu (slider 5) chữ vừa phải */
    #with_client_logo_3 h4 {
        font-size: 1.05rem;
        font-weight: 500;
        line-height: 1.6;
    }

    /* Tiêu đề danh mục chăm sóc */
    .card-img-overlay > h3.card-title {
        font-size: 1.5rem !important;
        line-height: 1.3 !important;
    }

    h2 {
        font-size: 1.75rem;
    }
    .custom-arrow .slick-slide p.fs-3 {
        font-size: 1.1rem !important;
    }

    /* Popup tìm kiếm */
    #searchModal .search-modal-logo img {
        height: 52px;
    }
    #searchModal .navbar {
        padding-top: 1.25rem !important;
        padding-bottom: 1.25rem !important;
    }
}

/* Khi mở popup tìm kiếm: ẩn logo header bị lộ dưới popup */
body:has(#searchModal.show) #header .navbar-brand,
body:has(#searchModal.showing) #header .navbar-brand {
    visibility: hidden;
}
@media (min-width: 1200px) {
    #searchModal .search-modal-logo img {
        height: 72px;
    }
}

/* Chăm sóc sắc đẹp / tóc / sức khoẻ (slider 7): 3 thẻ cùng kích thước */
.card:has(> .card-img-overlay > h3.card-title) {
    overflow: hidden;
    height: 100%;
}
.card:has(> .card-img-overlay > h3.card-title) > img {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    object-position: center;
}
.card-img-overlay > h3.card-title {
    margin-bottom: .5rem;
}
@media (max-width: 767.98px) {
    .card:has(> .card-img-overlay > h3.card-title) > img {
        aspect-ratio: 4 / 3;
    }
}
@media (min-width: 768px) {
    .card-img-overlay > h3.card-title {
        font-size: clamp(1.5rem, 2.2vw, 2.25rem) !important;
        line-height: 1.25 !important;
    }
}

/* Mạng xã hội: thẻ đều nhau, icon thương hiệu */
.social-grid .social-card {
    --brand: #1877f2;
    gap: .35rem;
    padding: 2rem 1rem 1.5rem;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .05);
    color: inherit;
    transition: transform .25s ease, box-shadow .25s ease;
}
.social-grid .social-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, .1);
}
.social-grid .social-card--tiktok { --brand: #111; }
.social-grid .social-card--youtube { --brand: #ff0000; }
.social-grid .social-card--instagram { --brand: #d62976; }
.social-grid .social-card__icon,
.social-grid .social-card__avatar {
    width: 72px;
    height: 72px;
    margin-bottom: .75rem;
    border-radius: 50%;
}
.social-grid .social-card__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand);
    color: #fff;
    font-size: 30px;
}
.social-grid .social-card--tiktok .social-card__icon {
    text-shadow: 2px 2px 0 #fe2c55, -2px -2px 0 #25f4ee;
}
.social-grid .social-card__avatar {
    object-fit: cover;
}
.social-grid .social-card__title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--bs-body-emphasis-color, #000);
}
.social-grid .social-card__handle {
    font-size: .85rem;
    color: #888;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.social-grid .social-card__btn {
    margin-top: auto;
    transform: translateY(.75rem);
    display: inline-block;
    padding: .45rem 1.5rem;
    border-radius: 999px;
    border: 1px solid var(--brand);
    color: var(--brand);
    font-size: .85rem;
    font-weight: 600;
    transition: background-color .2s, color .2s;
}
.social-grid .social-card:hover .social-card__btn {
    background: var(--brand);
    color: #fff;
}
.social-grid .social-card__handle {
    margin-bottom: 1rem;
}
@media (max-width: 575.98px) {
    .social-grid .social-card {
        padding: 1.5rem .75rem 1.25rem;
    }
    .social-grid .social-card__icon,
    .social-grid .social-card__avatar {
        width: 56px;
        height: 56px;
        font-size: 24px;
    }
    .social-grid .social-card__btn {
        padding: .35rem 1.1rem;
    }
}
