/* ========================================
   Compare Drawer - Module CSS
   ======================================== */

/* ══════════════════════════════════════════════════════════════
   COMPARE DRAWER
══════════════════════════════════════════════════════════════ */

/* Overlay mờ nhẹ */
.compare-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 20, 50, 0.35);
    backdrop-filter: blur(2px);
    z-index: 1099;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.compare-drawer-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* Drawer */
.compare-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 40px rgba(10, 30, 80, 0.18);
    z-index: 1100;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.compare-drawer.active {
    transform: translateY(0);
}

/* Header */
.compare-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px 14px;
    border-bottom: 1px solid #edf0f8;
    flex-shrink: 0;
}

.compare-drawer-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-3);
    display: flex;
    align-items: center;
    gap: 10px;
}

.compare-drawer-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.compare-drawer-title svg {
    width: 20px;
    height: 20px;
    color: var(--color-3);
}

.compare-drawer-badge {
    background: var(--color-3);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.compare-drawer-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #8898b3;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease, color 0.2s ease;
}

.compare-drawer-close:hover {
    background: #f0f4fb;
    color: var(--color-3);
}

.compare-drawer-close svg {
    width: 18px;
    height: 18px;
}

/* Body */
.compare-drawer-body {
    overflow-y: auto;
    flex: 1;
    padding: 20px 24px;
}

.compare-drawer-items {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.compare-drawer-empty {
    color: #8898b3;
    font-size: 14px;
    text-align: center;
    padding: 24px 0;
    display: none;
}

/* Item card */
.compare-drawer-item {
    flex: 0 0 220px;
    background: #f8faff;
    border: 1px solid #e4ebf8;
    border-radius: 14px;
    padding: 14px;
    display: flex;
    gap: 12px;
    position: relative;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.compare-drawer-item:hover {
    border-color: var(--color-3);
    box-shadow: 0 4px 16px rgba(26, 60, 122, 0.1);
}

.compare-drawer-item-img {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #e4ebf8;
}

.compare-drawer-item-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.compare-drawer-item-body {
    flex: 1;
    min-width: 0;
}

.compare-drawer-item-cat {
    font-size: 11px;
    color: #8898b3;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 4px;
}

.compare-drawer-item-name {
    font-size: 15px;
    font-weight: 600;
    color: #1a2340;
    line-height: 1.4;
    margin: 0 0 6px;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.compare-drawer-item-price {
    font-size: 15px;
    font-weight: 700;
    color: #e31e24;
}

.compare-drawer-item-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #fff;
    border: 1px solid #e4ebf8;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #8898b3;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.compare-drawer-item-remove:hover {
    background: #fee;
    color: #e31e24;
    border-color: #e31e24;
}

.compare-drawer-item-remove svg {
    width: 10px;
    height: 10px;
}

.compare-drawer-clear {
    background: none;
    border: 1px solid #d0d8ea;
    border-radius: 50px;
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #5a6a8a;
    cursor: pointer;
    transition: all 0.2s ease;
}

.compare-drawer-clear:hover {
    border-color: #e31e24;
    color: #e31e24;
    background: #fff5f5;
}

.compare-drawer-go {
    background: var(--color-3);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.22s ease, transform 0.22s ease;
    text-decoration: none;
}

.compare-drawer-go:hover {
    background: #0d2550;
    transform: translateY(-1px);
    color: #fff;
}

.compare-drawer-go svg {
    width: 14px;
    height: 14px;
}

/* Compare btn active state on card */
.btn-compare.is-compared {
    background: var(--color-3);
    color: #fff;
}

/* ══════════════════════════════════════════════════════════════
   COMPARE PAGE TABLE (TRANG SO SÁNH SẢN PHẨM)
══════════════════════════════════════════════════════════════ */
.compare-page {
    padding-top: 40px;
    padding-bottom: 60px;
}

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

.compare-title {
    font-size: 28px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 6px;
    letter-spacing: -0.02em;
    text-transform: uppercase;
}

.compare-subtitle {
    font-size: 14px;
    color: #64748b;
    margin: 0;
}

.compare-header-right {
    flex-shrink: 0;
}

.btn-clear-all-compare {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 50px;
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.22s ease;
}

.btn-clear-all-compare svg {
    width: 15px;
    height: 15px;
}

.btn-clear-all-compare:hover {
    border-color: #ef4444;
    color: #ef4444;
    background: #fef2f2;
}

/* Empty State */
.empty-compare {
    text-align: center;
    padding: 80px 20px;
    background: #ffffff;
    border-radius: 20px;
    border: 1px border-dashed #cbd5e1;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
    max-width: 540px;
    margin: 20px auto;
}

.empty-compare-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #f1f5f9;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.empty-compare-icon svg {
    width: 40px;
    height: 40px;
}

.empty-compare-title {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 10px;
}

.empty-compare-desc {
    font-size: 14px;
    color: #64748b;
    margin: 0 0 24px;
    line-height: 1.5;
}

.btn-back-home {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: var(--color-3);
    color: #ffffff;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.24s ease;
    box-shadow: 0 4px 16px rgba(10, 30, 80, 0.15);
}

.btn-back-home svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

.btn-back-home:hover {
    background: #0d2550;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(10, 30, 80, 0.25);
}

.btn-back-home:hover svg {
    transform: translateX(-3px);
}

/* Compare Table Wrapper */
.compare-table-wrapper {
    overflow-x: auto;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 35px rgba(15, 23, 42, 0.05);
    position: relative;
    max-height: 80vh;
}

/* Custom scrollbar for table */
.compare-table-wrapper::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

.compare-table-wrapper::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.compare-table-wrapper::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.compare-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Table Element */
.compare-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 750px;
}

.compare-table th,
.compare-table td {
    padding: 16px 20px;
    border-right: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    background: #ffffff;
}

.compare-table th:last-child,
.compare-table td:last-child {
    border-right: none;
}

/* Table Header */
.compare-table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #ffffff;
    border-bottom: 2px solid #e2e8f0;
    vertical-align: top;
    padding: 24px 20px 20px;
}

/* Sticky Column Spec Label */
.compare-table .spec-label {
    position: sticky;
    left: 0;
    z-index: 15;
    background: #f8fafc;
    width: 220px;
    min-width: 180px;
    font-size: 13.5px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-right: 2px solid #e2e8f0;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.02);
}

.compare-table thead th.spec-header-corner {
    z-index: 20;
    background: #f8fafc;
    vertical-align: middle;
    text-align: left;
}

.compare-table thead th.spec-header-corner span {
    /* font-size: 14px; */
    font-weight: 800;
    /* color: var(--color-3); */
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Product Column Header Card */
.compare-product-col {
    position: relative;
    width: 280px;
    min-width: 240px;
}

.compare-remove-product {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f1f5f9;
    border: none;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 2;
}

.compare-remove-product svg {
    width: 14px;
    height: 14px;
}

.compare-remove-product:hover {
    background: #fef2f2;
    color: #ef4444;
    transform: scale(1.1);
}

.compare-product-card-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.compare-product-img-wrap {
    width: 130px;
    height: 130px;
    border-radius: 12px;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #f1f5f9;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    transition: transform 0.28s ease, border-color 0.28s ease;
}

.compare-product-img-wrap:hover {
    transform: translateY(-3px);
    border-color: #cbd5e1;
}

.compare-product-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.compare-product-name {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.4;
    margin-bottom: 8px;
    text-decoration: none;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    /* min-height: 42px; */
    transition: color 0.2s ease;
}

.compare-product-name:hover {
    color: var(--color-3);
}

.compare-price-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.compare-price {
    font-size: 16.5px;
    font-weight: 800;
    color: #e11d48;
}

.compare-old-price {
    font-size: 13px;
    color: #94a3b8;
    text-decoration: line-through;
}

.compare-rating {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-bottom: 14px;
}

.compare-rating .star-rating {
    color: #f59e0b;
    font-size: 14px;
    letter-spacing: 1px;
}

.compare-rating .reviews-avg {
    font-size: 12.5px;
    font-weight: 700;
    color: #64748b;
}

.btn-compare-add-cart {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 18px;
    background: var(--color-3);
    color: #ffffff !important;
    border: none;
    border-radius: 50px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 3px 12px rgba(10, 30, 80, 0.12);
    transition: all 0.22s ease;
    white-space: nowrap;
    width: 100%;
}

.btn-compare-add-cart svg {
    width: 14px;
    height: 14px;
}

.btn-compare-add-cart:hover {
    background: #0d2550;
    transform: translateY(-1px);
    box-shadow: 0 5px 16px rgba(10, 30, 80, 0.22);
}

/* Table Body Rows */
.compare-table tbody tr {
    transition: background-color 0.2s ease;
}

.compare-table tbody tr:nth-child(even) td {
    background: #fafcff;
}

.compare-table tbody tr:nth-child(even) td.spec-label {
    background: #f1f5f9;
}

.compare-table tbody tr:hover td {
    background: #f0f6ff;
}

.compare-table tbody tr:hover td.spec-label {
    background: #e2e8f0;
    color: var(--color-3);
}

.spec-value {
    font-size: 14px;
    color: #334155;
    text-align: center;
    line-height: 1.5;
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE COMPARE PAGE
══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .compare-page {
        padding-top: 24px;
        padding-bottom: 40px;
    }

    .compare-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 20px;
    }

    .compare-title {
        font-size: 22px;
    }

    .compare-subtitle {
        font-size: 13px;
    }

    .compare-table .spec-label {
        width: 60px;
        min-width: 60px;
        font-size: 12px;
        padding: 12px 10px;
    }

    .compare-product-col {
        width: 200px;
        min-width: 180px;
    }

    .compare-table thead th {
        padding: 16px 12px 14px;
    }

    .compare-product-img-wrap {
        width: 90px;
        height: 90px;
        margin-bottom: 8px;
    }

    .compare-product-name {
        font-size: 13.5px;
        min-height: 38px;
    }

    .compare-price {
        font-size: 14.5px;
    }

    .compare-old-price {
        font-size: 12px;
    }

    .btn-compare-add-cart {
        padding: 7px 10px;
        font-size: 11.5px;
    }

    .compare-table th,
    .compare-table td {
        padding: 12px;
    }

    .spec-value {
        font-size: 13px;
    }
}

@media (max-width: 576px) {
    .compare-drawer {
        max-height: 85vh;
        border-radius: 16px 16px 0 0;
    }

    .compare-drawer-header {
        padding: 12px 14px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .compare-drawer-title {
        font-size: 14px;
        gap: 6px;
    }

    .compare-drawer-title svg {
        width: 18px;
        height: 18px;
    }

    .compare-drawer-badge {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }

    .compare-drawer-actions {
        gap: 8px;
        width: 100%;
        justify-content: start;
    }

    .compare-drawer-close {
        position: absolute;
        top: 8px;
        right: 10px;
        width: 28px;
        height: 28px;
    }

    .compare-drawer-clear {
        padding: 5px 12px;
        font-size: 11.5px;
    }

    .compare-drawer-go {
        padding: 6px 14px;
        font-size: 12px;
    }

    .compare-drawer-body {
        padding: 12px;
    }

    .compare-drawer-items {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .compare-drawer-item {
        padding: 10px;
        gap: 10px;
        border-radius: 10px;
    }

    .compare-drawer-item-img {
        width: 52px;
        height: 52px;
    }

    .compare-drawer-item-name {
        font-size: 13px;
        line-height: 1.3;
        margin-bottom: 3px;
    }

    .compare-drawer-item-price {
        font-size: 13px;
    }
}

/* Compare Page Column Remove Button */
.compare-product-col {
    position: relative;
    padding-top: 35px !important;
}

.compare-remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #ff4d4f;
    color: #ffffff;
    border: none;
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 5;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.compare-remove-btn:hover {
    background: #d9363e;
    transform: scale(1.1);
}
