/* General & Root Variables */
:root {
    /* Populated by PHP */
    --text-color: #333;
    --border-color: #e5e5e5;
}

body {
    background-color: #fff;
    font-family: var(--font-main), sans-serif;
    color: var(--text-color);
    font-size: 14px;
}

.icon-svg {
    width: 22px;
    height: 22px;
    vertical-align: middle;
}

/* Header */
.main-header {
    background-color: #fff;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.navbar-brand {
    font-weight: 500;
    font-size: 1.4rem;
    letter-spacing: 0.2em;
    color: var(--primary-color) !important;
}

.nav-link {
    font-weight: 400;
    color: var(--text-color) !important;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    transition: color 0.3s ease;
}

.header-icons .nav-link {
    font-size: 0.8rem;
    cursor: pointer;
}

.offcanvas {
    background-color: #fff;
    /* Thay đổi: Nền trắng giống nền chính */
}

.offcanvas .nav-link {
    /* Thay đổi: Màu chữ là màu chủ đạo */
    color: var(--primary-color) !important;
}

/* Sub-header / Filters */
.sub-header {
    background-color: var(--secondary-color);
    border-bottom: 1px solid var(--border-color);
    padding: 0.6rem 0;
}

.filter-nav .nav-link {
    font-size: 0.8rem;
    text-transform: none;
    letter-spacing: 0;
    color: #666 !important;
    cursor: pointer;
    white-space: nowrap;
    /* Ngăn các mục xuống dòng */
}

/* Cải tiến cho thanh điều hướng cuộn ngang trên di động */
.filter-nav {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    /* Cho phép cuộn ngang */
    -webkit-overflow-scrolling: touch;
    /* Cuộn mượt trên iOS */
    -ms-overflow-style: -ms-autohiding-scrollbar;
    /* Ẩn thanh cuộn trên IE/Edge */
}

/* Ẩn thanh cuộn mặc định trên trình duyệt Webkit (Chrome, Safari) */
.filter-nav::-webkit-scrollbar {
    display: none;
}

.filter-nav .nav-link.active {
    font-weight: 500;
    color: var(--primary-color) !important;
}

/* --- THEME BUTTONS --- */
.btn-theme-primary,
.btn-theme-secondary {
    border-radius: 0;
    padding: 0.85rem;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-theme-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.btn-theme-primary:hover,
.btn-theme-primary:focus {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
    opacity: 0.85;
}

.btn-theme-secondary {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.btn-theme-secondary:hover,
.btn-theme-secondary:focus {
    background-color: var(--secondary-color);
    border-color: var(--border-color);
    color: var(--primary-color);
}


/* Product Card */
.product-card {
    border: none;
    background-color: #fff;
    height: 100%;
    text-decoration: none;
    display: block;
    color: var(--text-color);
}

.product-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 100%;
    overflow: hidden;
    background-color: var(--secondary-color);
}

.product-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

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

.card-body {
    padding: 0.75rem 0;
}

/* Đặt màu mặc định cho tất cả card-title */
.card-title {
    font-size: 0.8rem;
    font-weight: 400;
    color: #212529;
    /* Màu đen mặc định */
    margin-bottom: 0.2rem;
}

.card-price {
    font-size: 0.8rem;
    font-weight: 500;
}

/* Product Detail Page */
.product-view-body {
    font-size: 15px;
}

.product-category {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6c757d;
}

.product-title {
    font-size: 1.45rem;
    font-weight: 600;
}

.product-price {
    font-size: 1.35rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.variant-label {
    font-weight: 500;
    margin-bottom: 0.75rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.variant-options .btn {
    border-radius: 0;
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.variant-options .btn.active {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.variant-options .btn:disabled {
    background-color: #f8f9fa;
    text-decoration: line-through;
}

.btn-add-to-cart {
    border-radius: 0;
    padding: 0.85rem;
    width: 100%;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    font-weight: 500;
    background-color: var(--primary-color);
    color: #fff;
    border: 1px solid var(--primary-color);
}

.btn-add-to-cart:hover {
    opacity: 0.85;
    color: #fff;
}

.product-description-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 0px solid var(--border-color);
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
}

.product-description-toggle:hover {
    color: var(--primary-color);
}

.product-description-toggle svg {
    transition: transform 0.3s ease;
}

.product-description-toggle[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

.product-description {
    font-size: 0.95rem;
    line-height: 1.8;
    color: #444;
}

.product-description h1,
.product-description h2,
.product-description h3,
.product-description h4,
.product-description h5,
.product-description h6 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.product-description table {
    width: 100% !important;
    border-collapse: collapse;
    margin: 1.5em 0;
}

.product-description th,
.product-description td {
    border: 1px solid var(--border-color);
    padding: 0.75em;
    text-align: left;
}

.product-description th {
    background-color: var(--secondary-color);
    table-layout: fixed;
    /* Thêm thuộc tính này để các cột giãn đều */
    width: 100%;
}

.product-description ul,
.product-description ol {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.product-description p {
    margin-bottom: 1rem;
}


/* Modals (General) */
.modal-content {
    border-radius: 0;
    border: none;
}

.modal-body {
    padding: 2rem;
}

/* Tom Select */
.ts-control {
    border-radius: 0;
    border-color: var(--border-color);
}

.ts-dropdown .ts-dropdown-content {
    border-radius: 0;
}

.ts-dropdown .option .item-image {
    width: 30px;
    height: 30px;
    object-fit: cover;
    margin-right: 10px;
}

/* Lightgallery */
#main-image,
#modal-main-image {
    cursor: zoom-in;
}

.gallery-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid transparent;
    padding: 2px;
    transition: border-color .3s ease;
}

.gallery-thumb.active {
    border-color: var(--primary-color);
}

/* Skeleton Loader */
.skeleton-card {
    background-color: #fff;
    border: none;
}

.skeleton-image {
    width: 100%;
    padding-top: 100%;
    background-color: #f0f0f0;
    position: relative;
    overflow: hidden;
}

.skeleton-text {
    height: 1em;
    background-color: #f0f0f0;
    margin-top: 0.75rem;
    width: 80%;
    border-radius: 0.125rem;
}

.skeleton-price {
    height: 1em;
    background-color: #f0f0f0;
    margin-top: 0.5rem;
    width: 40%;
    border-radius: 0.125rem;
}

.skeleton-image::after,
.skeleton-text::after,
.skeleton-price::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

/* --- CART STYLES --- */

/* Add to cart notification */
.cart-notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(200%);
    background-color: var(--primary-color);
    color: #fff;
    padding: 12px 25px;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 1060;
    /* Above modals */
    transition: transform 0.3s ease-in-out;
    font-size: 0.9rem;
}

.cart-notification.show {
    transform: translateX(-50%) translateY(0);
}

/* Cart Modal Styles */
#cartModal .modal-dialog {
    margin: 1.75rem auto;
}

@media (min-width: 576px) {
    #cartModal .modal-dialog {
        max-width: 450px;
    }
}

.object-fit-cover {
    object-fit: cover;
}

/* Footer */
.main-footer {
    background-color: var(--secondary-color);
    padding: 3rem 0;
    margin-top: 150px;
    font-size: 0.85rem;
}

.main-footer .footer-links a {
    text-decoration: none;
    /* Bỏ gạch chân mặc định */
    transition: text-decoration 0.2s ease-in-out;
}

.main-footer .footer-links a:hover {
    text-decoration: underline;
    /* Thêm gạch chân khi di chuột qua */
}

/* Fix for Related Products color on product-view page */
.related-products-section .product-card .card-title {
    color: #212529;
    /* Bootstrap's default dark color */
}

.related-products-section .product-card .card-price {
    color: #6c757d;
    /* Bootstrap's default muted color */
}

/* --- Responsive Adjustments --- */
@media (max-width: 767.98px) {
    .hero-title {
        font-size: 1.8rem;
        /* Giảm kích thước tiêu đề banner */
    }

    .product-title {
        font-size: 1.3rem;
        /* Giảm kích thước tiêu đề sản phẩm */
    }

    .product-price {
        font-size: 1.2rem;
    }

    /* Nút thêm vào giỏ chiếm toàn bộ chiều rộng trên di động */
    /* Đã bỏ width: 100% để 2 nút nằm cạnh nhau */
    /* Ngăn iOS tự động zoom khi focus vào ô tìm kiếm */
    #searchModal .ts-control input,
    #mainNavOffcanvas .ts-control input {
        font-size: 16px !important;
        /* Bắt buộc font-size tối thiểu để không bị zoom */
    }
}

/* Search Modal Styles */
.modal-dialog-top {
    margin-top: 5rem;
    margin-left: 1rem;
    margin-right: 1rem;
}

#searchModal .modal-content {
    background-color: transparent;
    border: none;
    box-shadow: none;
}

#searchModal .modal-body {
    padding: 0;
}

/* Cart Badge */
.cart-badge {
    background-color: var(--secondary-color);
    color: var(--filter-nav-color);
    position: absolute;
    top: -5px;
    right: -10px;
    font-size: 0.65rem;
    padding: 0.25em 0.5em;
    display: none;
    /* Ẩn mặc định, JS sẽ điều khiển */
}