/*
 * compare.css
 * Product comparison — floating bar + full comparison page.
 */

/* ── Compare checkbox on product cards ── */
.cmp-check-wrap {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.18s ease;
}

/* Show on card hover */
.pc-card:hover .cmp-check-wrap,
.fp-card:hover .cmp-check-wrap,
.pml-card:hover .cmp-check-wrap,
.rv-card:hover .cmp-check-wrap {
    opacity: 1;
}

/* Keep visible when checked (JS adds .cmp-check-visible) */
.cmp-check-visible {
    opacity: 1 !important;
}

/* Cards need position:relative so the absolute checkbox is positioned correctly */
.pc-card,
.fp-card,
.pml-card,
.rv-card {
    position: relative;
}

/* The checkbox must sit above the card's overflow boundary.
   We use overflow:visible on the card but contain the image via its own wrapper. */
.fp-card { overflow: visible; }
.fp-img-wrap { overflow: hidden; border-radius: 10px 10px 0 0; }

.pml-card { overflow: visible; }
.pml-img-link { overflow: hidden; }

/* pc-card (listing views) — make overflow visible so checkbox isn't clipped */
.pc-card { overflow: visible !important; }
/* Contain image overflow within its own wrapper AND preserve rounded corners */
.pc-card-img {
    overflow: hidden;
    border-radius: 13px 13px 0 0; /* match pc-card border-radius: 14px */
}

.cmp-check-wrap input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.85);
    border-radius: 4px;
    background: rgba(0,0,0,0.28);
    backdrop-filter: blur(4px);
    cursor: pointer;
    display: block;
    transition: background 0.18s, border-color 0.18s, transform 0.15s;
    flex-shrink: 0;
}

.cmp-check-wrap input[type="checkbox"]:checked {
    background: #009999;
    border-color: #009999;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath d='M1 5l3 4L11 1' stroke='%23fff' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 10px;
}

.cmp-check-wrap input[type="checkbox"]:hover {
    transform: scale(1.15);
    background: rgba(0,153,153,0.22);
    border-color: #009999;
    border-width: 2px;
    box-shadow: 0 0 0 3px rgba(0,153,153,0.18), 0 2px 8px rgba(0,153,153,0.25);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath d='M1 5l3 4L11 1' stroke='rgba(0,153,153,0.5)' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 10px;
}

/* ── Floating comparison bar ── */
#cmpBar {
    position: fixed;
    bottom: -120px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    background: #0d201a;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -8px 40px rgba(0,0,0,0.35);
    padding: 14px 20px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 320px;
    max-width: 94vw;
    transition: bottom 0.38s cubic-bezier(0.4, 0, 0.2, 1);
    border-top: 2px solid #009999;
}

#cmpBar.cmp-bar-visible {
    bottom: 0;
}

.cmp-bar-thumbs {
    display: flex;
    gap: 8px;
    align-items: center;
}

.cmp-bar-slot {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    border: 2px dashed rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
    transition: border-color 0.2s;
}

.cmp-bar-slot.filled {
    border-style: solid;
    border-color: #009999;
}

.cmp-bar-slot img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
}

.cmp-bar-slot .cmp-slot-empty {
    font-size: 20px;
    color: rgba(255,255,255,0.15);
    line-height: 1;
}

.cmp-bar-slot .cmp-slot-remove {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #e53e3e;
    color: #fff;
    border: none;
    font-size: 9px;
    line-height: 16px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cmp-bar-info {
    flex: 1;
    min-width: 0;
}

.cmp-bar-label {
    font-size: 11px;
    font-weight: 700;
    color: rgba(255,255,255,0.5);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    display: block;
    margin-bottom: 2px;
}

.cmp-bar-count {
    font-size: 13px;
    font-weight: 800;
    color: #fff;
}

.cmp-bar-count span {
    color: #00e5e5;
}

.cmp-bar-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.cmp-btn-compare {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #009999;
    color: #fff !important;
    font-size: 13px;
    font-weight: 700;
    padding: 10px 18px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    text-decoration: none !important;
    transition: background 0.18s, transform 0.15s;
    white-space: nowrap;
}

.cmp-btn-compare:hover {
    background: #007777;
    transform: translateY(-1px);
}

.cmp-btn-compare:disabled {
    background: #2d4a44;
    color: rgba(255,255,255,0.4) !important;
    cursor: not-allowed;
    transform: none;
}

.cmp-btn-clear {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    color: rgba(255,255,255,0.45);
    font-size: 12px;
    font-weight: 600;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
    cursor: pointer;
    transition: color 0.18s, border-color 0.18s;
    white-space: nowrap;
}

.cmp-btn-clear:hover {
    color: #e53e3e;
    border-color: rgba(229,62,62,0.4);
}

/* ── Compare page ── */
.cmp-page {
    background: #f6fbff;
    min-height: 60vh;
    padding: 0 0 56px;
}

.cmp-page-header {
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    padding: 20px 0;
    margin-bottom: 28px;
}

.cmp-page-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.cmp-page-title {
    font-size: 20px;
    font-weight: 900;
    color: #1e293b;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cmp-page-title i {
    color: #009999;
}

.cmp-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #009999 !important;
    text-decoration: none !important;
    transition: gap 0.18s;
}

.cmp-back-link:hover { gap: 9px; }

.cmp-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    overflow-x: auto;
}

/* ── Comparison table ── */
.cmp-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,0.07);
}

/* Header row — product cards */
.cmp-table thead tr th {
    padding: 0;
    vertical-align: top;
    width: calc(100% / 4);
    border-right: 1px solid #f0f4f8;
}

.cmp-table thead tr th:first-child {
    width: 160px;
    min-width: 140px;
}

.cmp-table thead tr th:last-child {
    border-right: none;
}

/* Product card in header */
.cmp-prod-card {
    padding: 20px 16px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    position: relative;
}

.cmp-prod-img {
    width: 110px;
    height: 110px;
    object-fit: contain;
    border-radius: 12px;
    background: #f8fafa;
    padding: 8px;
    border: 1px solid #e9ecef;
}

.cmp-prod-name {
    font-size: 13px;
    font-weight: 700;
    color: #111827;
    text-decoration: none !important;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.18s;
}

.cmp-prod-name:hover { color: #009999; }

.cmp-prod-price {
    font-size: 16px;
    font-weight: 900;
    color: #009999;
    display: block;
}

.cmp-prod-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #009999;
    color: #fff !important;
    font-size: 11.5px;
    font-weight: 700;
    padding: 8px 14px;
    border-radius: 8px;
    text-decoration: none !important;
    transition: background 0.18s;
    white-space: nowrap;
}

.cmp-prod-btn:hover { background: #007777; color: #fff !important; }

.cmp-prod-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #fee2e2;
    color: #e53e3e;
    border: none;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s;
}

.cmp-prod-remove:hover { background: #fecaca; }

/* Label column */
.cmp-row-label {
    padding: 14px 18px;
    font-size: 11.5px;
    font-weight: 800;
    color: #64748b;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: #f8fafc;
    border-right: 1px solid #f0f4f8;
    white-space: nowrap;
    border-top: 1px solid #f0f4f8;
}

/* Data cells */
.cmp-table tbody tr td {
    padding: 14px 18px;
    font-size: 13.5px;
    color: #374151;
    text-align: center;
    vertical-align: middle;
    border-top: 1px solid #f0f4f8;
    border-right: 1px solid #f0f4f8;
    line-height: 1.5;
}

.cmp-table tbody tr td:last-child {
    border-right: none;
}

/* Highlight best value */
.cmp-best {
    background: #ecfdf5;
    font-weight: 700;
    color: #059669 !important;
    position: relative;
}

.cmp-best::before {
    content: '✓ Best';
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 8.5px;
    font-weight: 800;
    color: #059669;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Row hover */
.cmp-table tbody tr:hover td {
    background: #f9feff;
}

/* Stars */
.cmp-stars {
    display: inline-flex;
    gap: 1px;
    align-items: center;
}

.cmp-stars i { font-size: 12px; }
.cmp-stars .fa-star      { color: #f59e0b; }
.cmp-stars .fa-star-half-o { color: #f59e0b; }
.cmp-stars .fa-star-o    { color: #d1d5db; }

/* In/out stock badge */
.cmp-stock-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
}

.cmp-stock-in  { background: #ecfdf5; color: #059669; }
.cmp-stock-low { background: #fffbeb; color: #b45309; }
.cmp-stock-out { background: #fef2f2; color: #dc2626; }

/* Empty state */
.cmp-empty {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}

.cmp-empty i {
    font-size: 48px;
    color: #e2e8f0;
    display: block;
    margin-bottom: 16px;
}

.cmp-empty h2 {
    font-size: 18px;
    font-weight: 700;
    color: #94a3b8;
    margin: 0 0 10px;
}

.cmp-empty p {
    font-size: 14px;
    color: #94a3b8;
    margin: 0 0 24px;
}

.cmp-empty a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #009999;
    color: #fff !important;
    font-size: 13px;
    font-weight: 700;
    padding: 11px 22px;
    border-radius: 10px;
    text-decoration: none !important;
    transition: background 0.18s;
}

.cmp-empty a:hover { background: #007777; }

/* Responsive */
@media (max-width: 768px) {
    .cmp-table thead tr th:first-child { width: 110px; min-width: 100px; }
    .cmp-prod-img { width: 80px; height: 80px; }
    .cmp-prod-price { font-size: 14px; }
    .cmp-row-label { padding: 12px 12px; font-size: 10.5px; }
    .cmp-table tbody tr td { padding: 12px 10px; font-size: 12.5px; }
    #cmpBar { min-width: 280px; padding: 12px 14px 14px; }
    .cmp-bar-slot { width: 38px; height: 38px; }
}

@media (max-width: 480px) {
    .cmp-bar-label { display: none; }
    .cmp-btn-compare { font-size: 12px; padding: 9px 13px; }
}
