/* ===================================================================
   Compare button on product cards
=================================================================== */
.btn-compare {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 3;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1.5px solid #e2e8f0;
    background: #fff;
    color: #718096;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.18s, border-color 0.18s, background 0.18s, color 0.18s;
    padding: 0;
}
.product-image-box:hover .btn-compare,
.btn-compare.active { opacity: 1; }
.btn-compare.active { background: #1a365d; border-color: #1a365d; color: #fff; }
.btn-compare:hover:not(.active) { border-color: #00a4bd; color: #00a4bd; }

/* ===================================================================
   Sticky compare tray
=================================================================== */
.compare-tray {
    position: fixed;
    bottom: -120px;
    left: 0;
    right: 0;
    z-index: 1040;
    background: #1a365d;
    color: #fff;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.18);
    transition: bottom 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}
.compare-tray.show { bottom: 0; }

.ctr-items {
    display: flex;
    gap: 8px;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
    min-width: 0;
}
.ctr-items::-webkit-scrollbar { display: none; }

.ctr-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 4px 8px 4px 4px;
    flex-shrink: 0;
    max-width: 180px;
}
.ctr-item img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 5px;
    background: #fff;
    flex-shrink: 0;
}
.ctr-item span {
    font-size: 0.72rem;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.ctr-remove {
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    padding: 0;
    cursor: pointer;
    font-size: 0.9rem;
    flex-shrink: 0;
    line-height: 1;
}
.ctr-remove:hover { color: #fff; }

.compare-tray-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.btn-compare-go {
    background: #00a4bd;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 7px 18px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.18s;
}
.btn-compare-go:hover { background: #008fa6; color: #fff; }
.btn-compare-clear {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.18s;
}
.btn-compare-clear:hover { background: rgba(255,255,255,0.22); }

/* ===================================================================
   Toast
=================================================================== */
.compare-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: #1a365d;
    color: #fff;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.85rem;
    opacity: 0;
    transition: opacity 0.25s, transform 0.25s;
    z-index: 1050;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.compare-toast.warn { background: #c05621; }
.compare-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===================================================================
   Full compare button (product show page)
=================================================================== */
.btn-compare-full {
    display: flex;
    align-items: center;
    width: 100%;
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #4a5568;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.btn-compare-full:hover { border-color: #00a4bd; color: #00a4bd; }
.btn-compare-full.active { border-color: #1a365d; background: #f0f5ff; color: #1a365d; }

/* ===================================================================
   Compare page — header (title + add button)
=================================================================== */
.cmp-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.compare-page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a365d;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    position: relative;
    display: inline-block;
    padding-bottom: 8px;
    margin-bottom: 0;
}
.compare-page-title::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    width: 40px; height: 3px;
    background: #00a4bd;
    border-radius: 2px;
}

.btn-cmp-add {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1.5px solid #1a365d;
    color: #1a365d;
    border-radius: 10px;
    padding: 8px 16px;
    font-size: 0.83rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.18s, color 0.18s, transform 0.12s;
    white-space: nowrap;
}
.btn-cmp-add:hover {
    background: #1a365d;
    color: #fff;
}
.btn-cmp-add:active { transform: translateY(1px); }
.btn-cmp-add i { font-size: 0.95rem; }

@media (max-width: 575px) {
    .cmp-page-header { gap: 8px; margin-bottom: 14px; }
    .compare-page-title { font-size: 1.2rem; }
    .btn-cmp-add {
        padding: 7px 12px;
        font-size: 0.76rem;
        border-radius: 8px;
    }
    .btn-cmp-add i { font-size: 0.85rem; }
}

/* ===================================================================
   Compare page — empty state
=================================================================== */
.compare-empty {
    text-align: center;
    padding: 80px 20px;
    color: #718096;
}
.compare-empty > i { font-size: 3rem; color: #cbd5e0; margin-bottom: 16px; display: block; }
.compare-empty h4 { color: #2d3748; margin-bottom: 8px; font-size: 1.1rem; }
.compare-empty p { margin-bottom: 18px; }

.btn-cmp-empty {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #1a365d;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 11px 22px;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.18s, transform 0.12s;
}
.btn-cmp-empty:hover { background: #14284a; color: #fff; }
.btn-cmp-empty:active { transform: translateY(1px); }

/* ===================================================================
   Compare page — layout
   Simple overflow-x scroll: no sticky, no max-content tricks
=================================================================== */
.compare-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1.5px solid #e8edf4;
    border-radius: 14px;
    background: #fff;
}

/* Label column */
.compare-label-col {
    flex: 0 0 110px;
    width: 110px;
    max-width: 110px;
    padding: 10px 10px 10px 12px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: #f8fafc;
    display: flex;
    align-items: center;
    border-right: 1px solid #eef1f6;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.35;
}

/* Product columns */
.compare-product-col {
    flex: 1 1 0;
    min-width: 170px;
    max-width: 200px;
    padding: 10px 14px;
    font-size: 0.85rem;
    color: #2b3445;
    display: flex;
    align-items: center;
    border-left: 1px solid #eef1f6;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.4;
}

/* Long content inside product cells (links, text) must respect column width */
.compare-product-col > * {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Rows */
.compare-cards-row,
.compare-row {
    display: flex;
    align-items: stretch;
}
.compare-row { border-bottom: 1px solid #f0f3f8; }
.compare-row:last-child { border-bottom: none; }
.compare-row:nth-child(even) .compare-product-col { background: #fafbfd; }
.compare-row:nth-child(even) .compare-label-col { background: #f4f6f9; }

/* Section title */
.compare-section-title {
    display: flex;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #718096;
    background: #edf1f7;
    padding: 7px 12px;
    border-top: 1.5px solid #e8edf4;
    border-bottom: 1.5px solid #e8edf4;
}

/* Cards row */
.compare-cards-row {
    border-bottom: 2px solid #e8edf4;
    align-items: stretch;
}
.compare-cards-row .compare-label-col {
    background: #fff;
    border-right-color: #eef1f6;
}
.compare-cards-row .compare-product-col {
    background: #fff;
    padding: 10px 8px;
    align-items: stretch;
    justify-content: center;
}

/* Product card — compact pretty */
.cmp-card {
    position: relative;
    background: #fff;
    border: 1px solid #e8edf4;
    border-radius: 10px;
    overflow: hidden;
    width: 100%;
    max-width: 170px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.18s, transform 0.18s, border-color 0.18s;
}
.cmp-card:hover {
    box-shadow: 0 6px 18px rgba(26,54,93,0.10);
    border-color: #cbd5e0;
    transform: translateY(-1px);
}

.cmp-card-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.95);
    color: #718096;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, transform 0.12s;
    padding: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}
.cmp-card-remove:hover { background: #e53e3e; color: #fff; transform: scale(1.08); }

.cmp-card-img-wrap {
    display: block;
    background: #f8fafc;
    padding: 10px;
    aspect-ratio: 1/1;
}
.cmp-card-img-wrap img { width: 100%; height: 100%; object-fit: contain; }

.cmp-card-body {
    padding: 8px 10px 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
}
.cmp-card-name {
    font-size: 0.74rem;
    font-weight: 700;
    color: #1a365d;
    line-height: 1.35;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.05em;
}
.cmp-card-name:hover { color: #00a4bd; }
.cmp-card-price {
    font-size: 0.88rem;
    font-weight: 800;
    color: #22863a;
}
.cmp-card-link {
    font-size: 0.68rem;
    color: #00a4bd;
    text-decoration: none;
    font-weight: 600;
    margin-top: 4px;
    padding-top: 6px;
    border-top: 1px solid #f0f3f8;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.cmp-card-link:hover { color: #008fa6; }
.cmp-card-link i { font-size: 0.75rem; transition: transform 0.18s; }
.cmp-card-link:hover i { transform: translateX(2px); }

.cmp-dash { color: #c8d0db; }

/* ===================================================================
   Mobile
=================================================================== */
@media (max-width: 767px) {
    .ctr-items { display: none; }
    .compare-tray { padding: 9px 12px; }
    .compare-tray-actions { width: 100%; }
    .btn-compare-go { flex: 1; text-align: center; }
}

@media (max-width: 575px) {
    .compare-label-col {
        flex: 0 0 80px;
        width: 80px;
        max-width: 80px;
        font-size: 0.64rem;
        padding: 8px 6px 8px 8px;
        letter-spacing: 0.02em;
    }
    .compare-product-col {
        flex: 1 1 130px;
        min-width: 130px;
        max-width: none;
        padding: 8px 10px;
        font-size: 0.76rem;
    }
    .compare-cards-row .compare-product-col { padding: 8px 6px; }
    .cmp-card { max-width: none; }
    .cmp-card-body { padding: 7px 8px 8px; }
    .cmp-card-name { font-size: 0.7rem; }
    .cmp-card-price { font-size: 0.8rem; }
    .cmp-card-link { font-size: 0.65rem; }
}
