/* base */
/*
==========================================================================
 Base Styles & Utilities
==========================================================================
*/

/* Đảm bảo font chữ nhất quán */
.my-wishlist-button,
.my-wishlist-icon .wishlist-item-count,
.wishlist-popup,
#my-wishlist-page {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* === Loader Spinner === */
@keyframes spin { to { transform: rotate(360deg); } }
.wishlist-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: #d90429;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* === Trạng thái trống === */
.wishlist-empty {
    text-align: center;
    padding: 40px 20px;
    color: #777;
    font-size: 14px;
}

/*
==========================================================================
 Guest Prompts (Yêu cầu đăng nhập)
==========================================================================
*/

/* Khu vực đăng nhập của khách (chung) */
.wishlist-guest-prompt,
.wishlist-guest-prompt-page {
    text-align: center;
}

/* Khu vực đăng nhập của khách trong popup */
.wishlist-guest-prompt {
    padding: 45px 0px; /* Thêm đệm trên/dưới 45px */
}

/* Khu vực đăng nhập của khách trên trang Yêu thích */
.wishlist-guest-prompt-page {
    padding: 2em 0; /* Thêm một chút khoảng đệm trên dưới cho đẹp hơn */
}
/* items */
/*
==========================================================================
 Wishlist Items (Dùng chung cho Popup và Trang Yêu thích)
==========================================================================
*/

.wishlist-item {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}
.wishlist-item:last-child {
    border-bottom: none;
}

/* --- Image --- */
.wishlist-item__image {
    flex-shrink: 0;
}
.wishlist-item__image img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border: 1px solid #eee;
}

/* --- Details --- */
.wishlist-item__details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0; /* Quan trọng: Cho phép text-overflow hoạt động đúng trong flexbox */
}
.wishlist-item__name {
    font-weight: bold;
    font-size: 13px;
    color: #333;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}
.wishlist-item__name:hover {
    color: #d90429;
}

/* --- Short Description --- */
.wishlist-item__short-desc {
    font-size: 12px;
    color: #555;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Reset margin của thẻ <p> nếu có trong mô tả ngắn */
.wishlist-item__short-desc p {
    margin: 0;
}

/* --- Price --- */
.wishlist-item__price {
    flex-shrink: 0;
    white-space: nowrap;
    margin-left: 10px;
    font-weight: 600;
    font-size: 12px;
    color: #000000;
}

/* --- Actions --- */
.wishlist-item__actions {
    margin-top: 4px;
    font-size: 11px;
}
.wishlist-item__actions .wishlist-item__remove {
    color: #0073aa;
    text-decoration: underline;
    cursor: pointer;
}
.wishlist-item__actions .wishlist-item__remove:hover {
    color: #d90429;
}
/* button */
/*
==========================================================================
 Wishlist Button (Trang sản phẩm & Shortcode)
==========================================================================
*/

/* === Style chung cho nút yêu thích (dạng text link/button) === */
.my-wishlist-button {
    cursor: pointer;
    margin-top: 15px;
    padding: 10px 15px;
    border: 1px solid #dcdcdc;
    background-color: #f9f9f9;
    color: #333;
    border-radius: 5px;
    transition: all 0.3s ease;
}
.my-wishlist-button:hover {
    background-color: #f0f0f0;
    border-color: #c0c0c0;
}
.my-wishlist-button.in-wishlist {
    background-color: #d90429;
    color: #fff;
    border-color: #d90429;
    /* cursor: default; /* Bỏ dòng này nếu muốn cho phép xóa bằng cách click lại */
}
.my-wishlist-button.loading {
    opacity: 0.7;
    cursor: wait;
}

/* === Style cho icon trái tim trên trang sản phẩm (Biến thể của .my-wishlist-button) === */
.single-product-wishlist-icon {
    display: inline-block;
    cursor: pointer;
    color: #333; /* Màu mặc định cho viền (stroke) */
    transition: all 0.2s ease;
    margin-top: 15px;
    line-height: 1;
    fill: none; /* Mặc định không tô màu (nền trong suốt) */
    border: none;
    background-color: transparent;
    padding: 0;
}

.single-product-wishlist-icon:hover {
    color: #d90429; /* Màu khi di chuột qua */
    background-color: transparent; /* Đảm bảo nền không đổi màu khi hover */
}

/* Quan trọng: Tô màu đầy cho icon khi được yêu thích */
.single-product-wishlist-icon.in-wishlist {
    color: #d90429; /* Màu đỏ cho viền */
    fill: #d90429;   /* Màu đỏ để tô đầy */
    background-color: transparent; /* Đảm bảo nền không đổi màu */
    border: none;
}

/* Style khi đang tải */
.single-product-wishlist-icon.loading {
    opacity: 0.5;
    cursor: wait;
}
/* icon */
/*
==========================================================================
 Wishlist Icon (Header/Menu)
==========================================================================
*/

.menu-item-wishlist {
    display: flex;
    align-items: center;
}
.my-wishlist-icon {
    position: relative;
    display: inline-flex;
    color: #333;
    text-decoration: none;
    cursor: pointer;
    fill: none; /* Mặc định icon header không tô màu */
}
.my-wishlist-icon .wishlist-item-count {
    position: absolute;
    top: -8px;
    right: -10px;
    background-color: #d90429;
    color: #fff;
    font-size: 10px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-sizing: border-box;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* Tùy chọn: Ẩn số đếm khi rỗng
.my-wishlist-icon.is-empty .wishlist-item-count {
    display: none;
}
*/
/* popup */
/*
==========================================================================
 Wishlist Popup Container
==========================================================================
*/

.wishlist-popup {
    position: absolute;
    width: 376px;
    z-index: 100000;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0.2s, opacity 0.2s, transform 0.2s;
    transform: translateY(10px);
}
.wishlist-popup.is-visible {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}
.wishlist-popup__content {
    background-color: #fff;
    display: flex;
    flex-direction: column;
    border: 1px solid #eee;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-height: 80vh;
}

/* --- Header --- */
.wishlist-popup__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}
.wishlist-popup__header h3 {
    margin: 0;
    font-size: 16px; /* Giảm kích thước font-size */
}
.wishlist-close {
    background: none !important;
    border: none !important;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    padding: 0 !important;
    margin: 0 !important;
    color: #555;
    transition: color 0.2s;
}
.wishlist-close:hover {
    color: #111;
}

/* --- Body --- */
.wishlist-popup__body {
    overflow-y: auto;
    padding: 10px 20px;
    max-height: 380px;
    flex-grow: 1;
}

/* --- Footer --- */
.wishlist-popup__footer {
    padding: 20px;
    border-top: 1px solid #eee;
    background-color: #f9f9f9;
    flex-shrink: 0;
}
.wishlist-popup__footer .button {
    display: block;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    background-color: #d90429;
    color: #fff;
    text-decoration: none;
    padding: 10px;
    border-radius: 5px;
    font-weight: bold;
}

/* --- Loader Overlay --- */
.wishlist-popup__loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 8px; /* Để bo tròn theo content */
}

/*
==========================================================================
 Tùy chỉnh riêng cho Items bên trong POPUP (Overrides)
==========================================================================
*/

/* Ẩn nút "Thêm vào giỏ" & "Lựa chọn tùy chọn" khỏi POPUP */
#wishlist-popup .wishlist-item__actions .button {
    display: none !important;
}

/* Căn chỉnh lại link "Xóa" trong popup cho đẹp */
#wishlist-popup .wishlist-item__actions {
    display: block;
    margin-top: 4px;
}
/* page */
/*
==========================================================================
 Style cho trang Yêu thích (/wishlist)
==========================================================================
*/

#my-wishlist-page {
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    padding: 2em 15px; /* Thêm khoảng cách lề trái/phải */
}

#my-wishlist-page .woocommerce-products-header {
    margin-bottom: 2em;
}

/* Tiêu đề trên trang /wishlist */
#my-wishlist-page .woocommerce-products-header__title {
    font-size: 20px; /* Giảm kích thước font-size */
}

#my-wishlist-page .wishlist-items-container .wishlist-item {
    padding: 20px 0;
}

/* Hiệu ứng khi xóa item trên trang wishlist */
.wishlist-item.removing {
    transition: opacity 0.3s ease-out;
}

/*
==========================================================================
 Tinh chỉnh bố cục trang Yêu thích (Overrides)
==========================================================================
*/

/* Áp dụng riêng cho các sản phẩm trên trang /wishlist */
#my-wishlist-page .wishlist-item {
    /* Căn các thành phần (ảnh, chi tiết, giá) ở trên cùng */
    align-items: flex-start; 
}

#my-wishlist-page .wishlist-item__details {
    /* Bỏ thiết lập mặc định (flex-grow: 1) để nó không tự động giãn ra */
    flex-grow: 0;
    
    /* Thiết lập chiều rộng chiếm khoảng 45% container */
    flex-basis: 45%; 
    
    /* Đặt giới hạn chiều rộng tối đa để không quá dài trên màn hình lớn */
    max-width: 450px; 
}

#my-wishlist-page .wishlist-item__price {
    /* Tự động đẩy phần giá về cuối dòng */
    margin-left: auto;
    
    /* Căn phải cho giá tiền */
    text-align: right;

    /* Thêm khoảng cách bên trái để không dính vào phần mô tả */
    padding-left: 20px;
}

/*
==========================================================================
 Định dạng nút "Thêm vào giỏ hàng" trên trang Yêu thích
==========================================================================
*/
#my-wishlist-page .wishlist-item__actions {
    /* Xếp các nút theo chiều dọc và căn trái */
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px; /* Khoảng cách giữa 2 nút */
    margin-top: 10px;
}

/* Định dạng chung cho nút của WooCommerce */
#my-wishlist-page .wishlist-item__actions .button {
    /* Reset lề mặc định */
    margin: 0 !important;

    /* Tùy chỉnh giao diện theo yêu cầu */
    background-color: #d90429; /* Màu đỏ */
    color: #fff !important;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 11px;
    line-height: 1.5;
    border: none;
}

#my-wishlist-page .wishlist-item__actions .button:hover {
    background-color: #b80021; /* Màu đỏ sẫm hơn */
    color: #fff !important;
}

/* Trạng thái loading và đã thêm của nút AJAX */
#my-wishlist-page .wishlist-item__actions .button.loading {
    opacity: 0.7;
    background-color: #d90429;
}

#my-wishlist-page .wishlist-item__actions .added_to_cart {
   display: none !important; /* Luôn ẩn link "Xem giỏ hàng" sau khi thêm */
}
.wishlist-pagination{display:flex;gap:12px;flex-wrap:wrap;margin-top:20px}.wishlist-error{padding:16px;color:#a00}
