/* =========================================
   GLOBAL
========================================= */

html,
body {
    height: 100%;
}

body {
    margin: 0;
    background-color: #ffffff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* =========================================
   HERO
========================================= */

.hero {
    width: min(1700px, calc(100% - 12px));
    max-width: 1700px;
    margin: 0 auto;
    padding: 0;
    background: transparent;
}

.hero img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 0;
}

/* iPad và tablet */
@media (min-width: 768px) and (max-width: 991.98px) {
    .hero {
        width: calc(100% - 16px);
        margin: 0 auto;
    }
}

/* Điện thoại */
@media (max-width: 767.98px) {
    .hero {
        width: 100%;
        margin: 0;
    }
}


/* =========================================
   NAVBAR
========================================= */

.navbar-brand {
    font-size: 1.4rem;
}


/* =========================================
   PRODUCT CARDS
========================================= */

.card,
.product-card {
    transition: transform .25s ease, box-shadow .25s ease;
    border-radius: 10px;
    overflow: hidden;
}

.product-card {
    margin-bottom: 30px;
    border: 1px solid #ddd;
}

.card:hover,
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .12);
}

/* Khung ảnh */
.card-img-top,
.product-image-wrapper {
    height: 220px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #fff;
    padding: 10px;
}

/* Ảnh */
.product-card img,
.product-img {
    max-width: 75%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.price {
    color: #dc3545;
    font-size: 26px;
    font-weight: 700;
}


/* =========================================
   CART COUNT
========================================= */

.cart-count {
    position: absolute;
    top: 0;
    right: -8px;
    font-size: 11px;
}


/* =========================================
   OLD CATEGORY BUTTONS
========================================= */

.category-btn {
    margin: 4px;
}


/* =========================================
   LEFT CATEGORY SIDEBAR
========================================= */

.left-category-sidebar {
    position: sticky;
    top: 90px;
    overflow: hidden;
    background-color: #ffffff;
    border: 1px solid #e2e5e9;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
}

.left-category-header {
    padding: 16px 18px;
    background-color: #0d6efd;
    color: #ffffff;
    font-size: 18px;
    font-weight: 700;
}

.left-category-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 10px;
}

.costco-left-category-item {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    background-color: transparent;
    color: #333333;
    border: none;
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}

.costco-left-category-item:hover {
    background-color: #eef5ff;
    color: #0d6efd;
    transform: translateX(3px);
}

.costco-left-category-item.is-selected {
    background-color: #0d6efd;
    color: #ffffff;
    font-weight: 600;
}

.left-category-name {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.left-category-name i {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.left-category-count {
    min-width: 28px;
    padding: 2px 8px;
    background-color: #f1f3f5;
    color: #6c757d;
    border-radius: 20px;
    font-size: 12px;
    text-align: center;
    flex-shrink: 0;
}

.costco-left-category-item.is-selected .left-category-count {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}



/* =========================================
   MOBILE CATEGORY COMBOBOX
========================================= */

.mobile-category-select-wrapper {
    display: none;
    padding: 12px;
    background-color: #ffffff;
}

.mobile-category-select-wrapper .form-label {
    margin-bottom: 7px;
    color: #333333;
    font-size: 14px;
    font-weight: 700;
}

.mobile-category-select-wrapper .form-select {
    min-height: 46px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    color: #212529;
    font-size: 15px;
    background-color: #ffffff;
}

.mobile-category-select-wrapper .form-select:focus {
    border-color: #15803d;
    box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.15);
}

@media (max-width: 767.98px) {
    .mobile-category-select-wrapper {
        display: block;
    }

    .left-category-list {
        display: none !important;
    }

    .left-category-sidebar {
        position: static;
        margin-bottom: 20px;
    }
}

/* Navbar */
.custom-navbar {
    background: linear-gradient(90deg,
            #14532d 0%,
            #15803d 50%,
            #22c55e 100%);
    box-shadow: 0 6px 18px rgba(20, 83, 45, .25);
}

/* Logo */
.navbar-brand {
    color: #FFD54F !important;
    font-weight: 700;
    font-size: 30px;
}

/* Menu */
.navbar .nav-link {
    color: #ffffff !important;
    font-weight: 500;
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
    color: #FFD54F !important;
}

/* Badge giỏ hàng */
.cart-count {
    background: #FFD54F !important;
    color: #1b4332 !important;
    font-weight: bold;
}

.btn-primary {
    background: #15803d !important;
    border-color: #15803d !important;
}

.btn-primary:hover {
    background: #166534 !important;
    border-color: #166534 !important;
}

.badge.bg-primary {
    background: #15803d !important;
}

.left-category-header {
    background: #14532d !important;
}

.costco-left-category-item.is-selected {
    background: #15803d !important;
}

.page-item.active .page-link {
    background: #15803d !important;
    border-color: #15803d !important;
}

.page-link {
    color: #15803d !important;
}

.page-link:hover {
    color: #166534 !important;
}

/* Tên sản phẩm: tối đa 2 dòng */
#product-list .product-title,
#product-list .card-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    min-height: 2.6em;
    margin-bottom: 8px;
}

/* Nội dung mô tả: tối đa 3 dòng */
#product-list .product-description,
#product-list .card-text {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.45;
    max-height: 4.35em;
    margin-bottom: 12px;
}


/* =========================================
   PRODUCT DETAIL PAGE
========================================= */

.product-main-image-card {
    position: relative;
    overflow: hidden;
}

.product-main-image-wrapper {
    width: 100%;
    height: 430px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: #ffffff;
    border-radius: 10px;
    cursor: zoom-in;
}

.product-main-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transform-origin: center center;
    transition: transform 0.2s ease;
    user-select: none;
    -webkit-user-drag: none;
}

.product-image-controls {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 5;
    display: flex;
    gap: 6px;
}

.product-image-controls .btn {
    width: 38px;
    height: 38px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.product-thumbnail-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.product-thumbnail-button {
    width: 88px;
    height: 88px;
    padding: 4px;
    background-color: #ffffff;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    transition:
        border-color 0.2s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.product-thumbnail-button:hover {
    border-color: #86b7fe;
    transform: translateY(-2px);
}

.product-thumbnail-button.active {
    border-color: #15803d;
    box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.18);
}

.product-thumbnail-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 5px;
}

.product-image-counter {
    margin-top: 10px;
    color: #6c757d;
    font-size: 14px;
}

.product-description {
    white-space: pre-line;
}


/* =========================================
   PRODUCT IMAGE MODAL GALLERY
========================================= */

.zoom-modal-image-area {
    position: relative;
    height: 75vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 96px;
    background-color: #111111;
    cursor: grab;
}

.zoom-modal-image-area.dragging {
    cursor: grabbing;
}

.zoom-modal-image {
    max-width: 100%;
    max-height: calc(100% - 10px);
    object-fit: contain;
    transform-origin: center center;
    user-select: none;
    -webkit-user-drag: none;
}

.zoom-gallery-btn {
    position: absolute;
    top: calc(50% - 48px);
    z-index: 30;
    width: 52px;
    height: 68px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: #222222;
    font-size: 24px;
    cursor: pointer;
    transform: translateY(-50%);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
    transition:
        background-color 0.2s ease,
        color 0.2s ease;
}

.zoom-gallery-btn:hover {
    background: #ffffff;
    color: #15803d;
}

.zoom-gallery-prev {
    left: 16px;
}

.zoom-gallery-next {
    right: 16px;
}

.zoom-gallery-counter {
    position: absolute;
    left: 50%;
    bottom: 105px;
    z-index: 30;
    padding: 6px 13px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.68);
    color: #ffffff;
    font-size: 14px;
    transform: translateX(-50%);
    pointer-events: none;
}

.zoom-gallery-thumbnails {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 25;
    min-height: 96px;
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    overflow-x: auto;
    padding: 12px 18px;
    background: rgba(0, 0, 0, 0.84);
    scrollbar-width: thin;
}

.zoom-gallery-thumbnail-btn {
    flex: 0 0 72px;
    width: 72px;
    height: 72px;
    padding: 3px;
    border: 2px solid transparent;
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
    opacity: 0.72;
    transition:
        border-color 0.2s ease,
        transform 0.2s ease,
        opacity 0.2s ease;
}

.zoom-gallery-thumbnail-btn:hover {
    transform: translateY(-2px);
    opacity: 1;
}

.zoom-gallery-thumbnail-btn.active {
    border-color: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
    opacity: 1;
}

.zoom-gallery-thumbnail-img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    border-radius: 5px;
    background: #ffffff;
}


/* =========================================
   PRODUCT DETAIL RESPONSIVE
========================================= */

@media (max-width: 767.98px) {
    .product-main-image-wrapper {
        height: 300px;
    }

    .product-thumbnail-list {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 6px;
    }

    .product-thumbnail-button {
        width: 72px;
        height: 72px;
        flex: 0 0 72px;
    }

    .zoom-modal-image-area {
        height: 65vh;
        padding-bottom: 82px;
    }

    .zoom-gallery-btn {
        top: calc(50% - 41px);
        width: 42px;
        height: 56px;
        font-size: 19px;
    }

    .zoom-gallery-prev {
        left: 6px;
    }

    .zoom-gallery-next {
        right: 6px;
    }

    .zoom-gallery-counter {
        bottom: 89px;
    }

    .zoom-gallery-thumbnails {
        min-height: 82px;
        justify-content: flex-start;
        padding: 10px 12px;
    }

    .zoom-gallery-thumbnail-btn {
        flex-basis: 60px;
        width: 60px;
        height: 60px;
    }
}


/* =========================================
   RECOMMENDED PRODUCTS
========================================= */

.recommended-products-section {
    position: relative;
    padding-top: 8px;
}

.recommended-products-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.recommended-products-eyebrow {
    color: #15803d;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Nút trái/phải nằm giữa hai mép của hàng sản phẩm */
.recommended-products-actions {
    position: absolute;
    top: 56%;
    left: -23px;
    right: -23px;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    transform: translateY(-50%);
}

.recommended-scroll-btn {
    width: 48px;
    height: 64px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d8dee6;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    color: #1f2937;
    font-size: 20px;
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.18);
    cursor: pointer;
    pointer-events: auto;
    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        box-shadow 0.2s ease,
        opacity 0.2s ease;
}

.recommended-scroll-btn:hover:not(:disabled) {
    transform: scale(1.05);
    border-color: #15803d;
    color: #15803d;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.24);
}

.recommended-scroll-btn:disabled {
    cursor: not-allowed;
    opacity: 0.28;
}

.recommended-products-list {
    display: flex;
    gap: 18px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    padding: 4px 3px 18px;
}

.recommended-product-card {
    flex: 0 0 calc((100% - 54px) / 4);
    min-width: 235px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    scroll-snap-align: start;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 5px 18px rgba(15, 23, 42, 0.07);
    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease;
}

.recommended-product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.13);
}

.recommended-product-image-link {
    height: 210px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: #ffffff;
    text-decoration: none;
}

.recommended-product-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    transition: transform 0.25s ease;
}

.recommended-product-card:hover .recommended-product-image {
    transform: scale(1.04);
}

.recommended-product-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 17px;
    border-top: 1px solid #edf0f4;
}

.recommended-product-category {
    margin-bottom: 7px;
    color: #15803d;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.recommended-product-name {
    min-height: 48px;
    display: -webkit-box;
    overflow: hidden;
    color: #172033;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.45;
    text-decoration: none;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.recommended-product-name:hover {
    color: #15803d;
}

.recommended-product-price {
    margin-top: 11px;
    color: #dc2626;
    font-size: 20px;
    font-weight: 800;
}

.recommended-product-stock {
    margin: 7px 0 15px;
    font-size: 13px;
    font-weight: 600;
}

.recommended-product-stock.in-stock {
    color: #15803d;
}

.recommended-product-stock.out-of-stock {
    color: #dc2626;
}

@media (max-width: 991.98px) {
    .recommended-product-card {
        flex-basis: calc((100% - 36px) / 3);
    }
}

@media (max-width: 767.98px) {
    .recommended-products-header {
        align-items: center;
    }

    .recommended-products-actions {
        top: 57%;
        left: 4px;
        right: 4px;
    }

    .recommended-scroll-btn {
        width: 40px;
        height: 56px;
        font-size: 17px;
        background: rgba(255, 255, 255, 0.94);
    }

    .recommended-product-card {
        flex-basis: 72%;
        min-width: 230px;
    }

    .recommended-product-image-link {
        height: 190px;
    }
}

@media (max-width: 480px) {
    .recommended-product-card {
        flex-basis: 84%;
    }
}

.footer {
    background: #212529;
    color: #fff;
    padding: 50px 0 20px;
    margin-top: auto;
}

.footer-title {
    color: #ffc107;
    font-weight: bold;
}

.footer h5 {
    margin-bottom: 18px;
    font-weight: 600;
}

.footer p {
    margin-bottom: 10px;
    color: #ddd;
}

.footer-links {
    list-style: none;
    padding: 0;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: #ddd;
    text-decoration: none;
}

.footer-links a:hover {
    color: #ffc107;
}

.social-icons a {
    display: inline-flex;
    width: 42px;
    height: 42px;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    background: #343a40;
    color: #fff;
    margin-right: 10px;
    transition: .3s;
}

.social-icons a:hover {
    background: #ffc107;
    color: #000;
}

.footer hr {
    border-color: rgba(255, 255, 255, .15);
}

.footer .text-center {
    color: #aaa;
}

.admin-footer {
    margin-top: 40px;
    padding: 15px 20px;
    text-align: center;
    background: #fff;
    border-top: 1px solid #dee2e6;
    color: #6c757d;
    font-size: 14px;
}

.admin-footer small {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #adb5bd;
}
/* Nút giỏ hàng nổi phía trên nút chat */
.floating-cart-button {
    position: fixed;
    right: 24px;
    bottom: 105px;
    z-index: 9998;

    width: 60px;
    height: 60px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;
    background-color: #15803d;
    color: #ffffff;
    font-size: 24px;
    text-decoration: none;

    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.24);

    transition:
        transform 0.2s ease,
        background-color 0.2s ease;
}

.floating-cart-button:hover {
    background-color: #166534;
    color: #ffffff;
    transform: scale(1.06);
}

.floating-cart-count {
    position: absolute;
    top: -4px;
    right: -4px;

    min-width: 22px;
    height: 22px;
    padding: 0 6px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 2px solid #ffffff;
    border-radius: 999px;

    background-color: #ffd54f;
    color: #1b4332;

    font-size: 12px;
    font-weight: 700;
}

@media (max-width: 767.98px) {
    .floating-cart-button {
        right: 16px;
        bottom: 96px;

        width: 54px;
        height: 54px;

        font-size: 21px;
    }
}

.navbar .nav-link {
    color: #ffffff !important;
    font-weight: 400;
    font-size: 29px;
}