/**
 * WooCommerce Product Compare CSS.
 */

/* Nút so sánh wrapper */
.wc-product-compare-button-wrapper {
    display: inline-block;
    margin: 5px 0;
}

/* Nút so sánh */
.wc-product-compare-button {
    display: inline-block;
    padding: 10px 15px;
    margin: 5px 0;
    background-color: #f7f7f7;
    color: #515151;
    border: 1px solid #ccc;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    text-align: center;
    text-decoration: none;
    transition: all 0.3s ease;
}

.wc-product-compare-button:hover {
    background-color: #e6e6e6;
    color: #333;
    border-color: #adadad;
}

.wc-product-compare-button.added {
    background-color: #4CAF50;
    color: #fff;
    border-color: #449d48;
}

.wc-product-compare-button.added:hover {
    background-color: #449d48;
}

.wc-product-compare-button.loading {
    opacity: 0.7;
    cursor: wait;
    position: relative;
}

.wc-product-compare-button.loading:after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 15px;
    height: 15px;
    margin: -7.5px 0 0 -7.5px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-top-color: rgba(0, 0, 0, 0.8);
    border-radius: 50%;
    animation: wc-product-compare-spinner 0.8s linear infinite;
}

@keyframes wc-product-compare-spinner {
    to {
        transform: rotate(360deg);
    }
}

/* Nút so sánh trong vòng lặp sản phẩm */
.wc-product-compare-button.loop {
    display: block;
    width: 100%;
    margin: 5px 0;
}

/* Popup so sánh */
.wc-product-compare-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
}

.wc-product-compare-popup.active {
    display: flex;
}

.wc-product-compare-popup-inner {
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.wc-product-compare-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid #e5e5e5;
}

.wc-product-compare-popup-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.wc-product-compare-popup-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    transition: color 0.3s ease;
}

.wc-product-compare-popup-close:hover {
    color: #333;
}

.wc-product-compare-popup-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.wc-product-compare-popup-empty {
    text-align: center;
    font-size: 16px;
    color: #666;
    padding: 20px 0;
}

.wc-product-compare-popup-products {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.wc-product-compare-popup-product {
    flex: 1;
    min-width: 150px;
    max-width: calc(25% - 15px);
    background-color: #f9f9f9;
    border: 1px solid #e5e5e5;
    border-radius: 3px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.wc-product-compare-popup-product-image {
    margin-bottom: 10px;
}

.wc-product-compare-popup-product-image img {
    max-width: 100%;
    height: auto;
    display: block;
}

.wc-product-compare-popup-product-title {
    margin-bottom: 10px;
    line-height: 1.3;
    font-weight: 500;
}

.wc-product-compare-popup-product-title a {
    color: #333;
    text-decoration: none;
}

.wc-product-compare-popup-product-title a:hover {
    color: #4CAF50;
}

.wc-product-compare-popup-product-actions {
    margin-top: auto;
}

.wc-product-compare-remove-product {
    background-color: #f44336;
    color: #fff;
    border: none;
    border-radius: 3px;
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.wc-product-compare-remove-product:hover {
    background-color: #d32f2f;
}

.wc-product-compare-popup-info {
    text-align: center;
    margin-bottom: 15px;
    color: #666;
}

.wc-product-compare-popup-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.wc-product-compare-popup-actions .button {
    padding: 10px 15px;
    text-decoration: none;
    border-radius: 3px;
    font-size: 14px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.wc-product-compare-view-table {
    background-color: #4CAF50;
    color: #fff;
    border: 1px solid #449d48;
}

.wc-product-compare-view-table:hover {
    background-color: #449d48;
}

.wc-product-compare-clear-all {
    background-color: #f44336;
    color: #fff;
    border: 1px solid #d32f2f;
}

.wc-product-compare-clear-all:hover {
    background-color: #d32f2f;
}

/* Bảng so sánh */
.wc-product-compare-table-wrapper {
    margin: 30px 0;
    overflow-x: auto;
}

.wc-product-compare-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #e5e5e5;
    background-color: #fff;
}

.wc-product-compare-table th,
.wc-product-compare-table td {
    padding: 15px;
    border: 1px solid #e5e5e5;
    text-align: center;
    vertical-align: middle;
}

.wc-product-compare-table th {
    background-color: #f7f7f7;
    font-weight: 600;
}

.wc-product-compare-table-field-header,
.wc-product-compare-table-field-name {
    text-align: left;
    font-weight: 600;
    background-color: #f7f7f7;
    min-width: 150px;
}

.wc-product-compare-table-product-header {
    min-width: 200px;
}

.wc-product-compare-table-product-image {
    margin-bottom: 10px;
}

.wc-product-compare-table-product-image img {
    max-width: 100px;
    height: auto;
    display: block;
    margin: 0 auto;
}

.wc-product-compare-table-product-title {
    margin-bottom: 10px;
    line-height: 1.3;
    font-weight: 500;
}

.wc-product-compare-table-product-title a {
    color: #333;
    text-decoration: none;
}

.wc-product-compare-table-product-title a:hover {
    color: #4CAF50;
}

.wc-product-compare-table-product-actions {
    margin-top: 10px;
}

.wc-product-compare-table-actions {
    margin-bottom: 15px;
    text-align: right;
}

.wc-product-compare-table-empty {
    padding: 20px;
    text-align: center;
    background-color: #f9f9f9;
    border: 1px solid #e5e5e5;
    border-radius: 3px;
    margin: 30px 0;
    font-size: 16px;
    color: #666;
}

.wc-product-compare-empty-value {
    color: #999;
}

.wc-product-compare-out-of-stock {
    color: #f44336;
    font-weight: 500;
}

.wc-product-compare-table-add-to-cart-row {
    background-color: #f9f9f9;
}

/* Alternating rows */
.wc-product-compare-table tbody tr:nth-child(odd) {
    background-color: #f9f9f9;
}

/* Responsive */
@media screen and (max-width: 768px) {
    .wc-product-compare-popup-product {
        max-width: calc(50% - 15px);
    }
}

@media screen and (max-width: 480px) {
    .wc-product-compare-popup-product {
        max-width: 100%;
    }
    
    .wc-product-compare-popup-actions {
        flex-direction: column;
    }
    
    .wc-product-compare-table-product-header {
        min-width: 150px;
    }
}

/* Fix popup scroll trên body */
body.wc-product-compare-popup-open {
    overflow: hidden;
}

/* Thông báo khi thêm sản phẩm vào so sánh */
.wc-product-compare-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #4CAF50;
    color: #fff;
    padding: 15px 20px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 300px;
    max-width: 400px;
    cursor: pointer;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
}

.wc-product-compare-notification.show {
    transform: translateX(0);
    opacity: 1;
}

.wc-product-compare-notification:hover {
    background-color: #449d48;
}

.wc-product-compare-notification-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.wc-product-compare-notification-message {
    font-weight: 600;
    margin-bottom: 3px;
    font-size: 14px;
}

.wc-product-compare-notification-count {
    font-size: 12px;
    opacity: 0.9;
}

.wc-product-compare-notification-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    margin-left: 15px;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.wc-product-compare-notification-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Responsive cho thông báo */
@media screen and (max-width: 480px) {
    .wc-product-compare-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        min-width: auto;
        max-width: none;
    }
}

/* Fix style cho widget */
.widget_wc_product_compare .wc-product-compare-widget-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.widget_wc_product_compare .wc-product-compare-widget-item {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e5e5;
}

.widget_wc_product_compare .wc-product-compare-widget-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.widget_wc_product_compare .wc-product-compare-widget-item-image {
    float: left;
    margin-right: 10px;
    width: 50px;
}

.widget_wc_product_compare .wc-product-compare-widget-item-title {
    margin: 0;
    font-size: 14px;
    line-height: 1.3;
    overflow: hidden;
}

.widget_wc_product_compare .wc-product-compare-widget-actions {
    margin-top: 15px;
    text-align: center;
}

.widget_wc_product_compare .wc-product-compare-widget-clear {
    display: inline-block;
    padding: 5px 10px;
    background-color: #f44336;
    color: #fff;
    border: none;
    border-radius: 3px;
    text-decoration: none;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.widget_wc_product_compare .wc-product-compare-widget-clear:hover {
    background-color: #d32f2f;
}

.widget_wc_product_compare .wc-product-compare-widget-view {
    display: inline-block;
    padding: 5px 10px;
    background-color: #4CAF50;
    color: #fff;
    border: none;
    border-radius: 3px;
    text-decoration: none;
    font-size: 12px;
    margin-right: 5px;
    transition: background-color 0.3s ease;
}

.widget_wc_product_compare .wc-product-compare-widget-view:hover {
    background-color: #449d48;
}

.widget_wc_product_compare .wc-product-compare-widget-empty {
    text-align: center;
    padding: 10px;
    color: #666;
}

/* Elementor Widget Style */
.elementor-widget-wc_product_compare_button .wc-product-compare-button,
.elementor-widget-wc_product_compare_table .wc-product-compare-table-wrapper {
    margin: 0;
}