﻿/* ============================ COMPARE PAGE ============================ */

.compare-wrap {
    background: #fff;
    border: 1px solid var(--ae-border);
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(17,24,39,.06);
    overflow: hidden;
    padding: 1rem 1.25rem;
}

/* sticky header row for horizontal scroll */
.compare-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f3f6ff; /* brand-tinted header */
    color: var(--ae-primary-700);
    font-weight: 700;
    border-bottom: 1px solid var(--ae-border);
}

/* sticky left spec column */
.compare-table tbody th {
    position: sticky;
    left: 0;
    z-index: 3; /* puțin mai sus ca să stea peste celulele normale */
    background: rgba(248, 250, 252, 0.75); /* semi-transparent */
    backdrop-filter: blur(4px); /* mic blur de sticlă */
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e293b;
}

/* spacing & typography */
.compare-table td,
.compare-table th {
    font-size: 1.15rem;
    line-height: 1.5;
    padding: 1rem 1.25rem;
}

/* subtle zebra + hover */
.compare-table tbody tr:nth-child(odd) td {
    background: #fbfdff;
}

.compare-table tbody tr:hover td {
    background: #f9fbff;
}

/* brand separators between product columns */
.compare-table td:not(:first-child) {
    border-left: 3px solid rgba(34,76,154,.3);
    box-shadow: inset 0 -1px 0 0 rgba(34,76,154,.15);
}

/* price emphasis */
.compare-price {
    color: var(--ae-primary);
    font-size: 1.2rem;
    font-weight: 700;
}

/* -------------------- Header cell content (image + titles) -------------------- */

/* ===================== REFINED HEADER (centered content + top-right close) ===================== */

.compare-colhead {
    min-width: 320px;
    position: relative;
    text-align: center;
    vertical-align: top;
}

    /* Center all header content */
    .compare-colhead .d-flex {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.4rem;
        text-align: center;
        position: relative;
        padding-top: 0.5rem;
    }

    /* Thumbnail centered */
    .compare-colhead .thumb {
        width: 220px;
        height: 150px;
        object-fit: cover;
        border-radius: 12px;
        border: 1px solid var(--ae-border);
        box-shadow: 0 6px 16px rgba(0, 0, 0, .12);
        display: block;
        margin: 0 auto;
    }

    /* Text and link centered */
    .compare-colhead .fw-semibold,
    .compare-colhead .small {
        text-align: center;
        white-space: normal;
        overflow: visible;
        text-overflow: initial;
        display: block;
    }

    /* Move X to top-right corner and make smaller */
    .compare-colhead form {
        position: absolute;
        top: 4px;
        right: 6px;
        margin: 0;
    }

    .compare-colhead .btn-close {
        width: 5px; /* smaller size */
        height: 5px;
        padding: 0;
        border-radius: 50%;
        background-color: #ef4444 !important; /* red background */
        border: none;
        opacity: 1;
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.9rem;
        transition: background-color 0.2s ease, transform 0.1s ease;
    }

        .compare-colhead .btn-close:hover {
            background-color: #dc2626 !important; /* darker red */
            transform: scale(1.05);
        }

    /* Make sure title and link are centered below image */
    .compare-colhead .flex-grow-1 {
        text-align: center;
        width: 100%;
    }

/* Responsive */
@media (max-width: 576px) {
    .compare-colhead .thumb {
        width: 180px;
        height: 120px;
    }
}

/* -------------------- “Show differences” toolbar -------------------- */

.compare-toolbar-wrap {
    position: sticky;
    top: calc(var(--header-offset,56px) + 8px);
    z-index: 1050;
    padding: .5rem 0;
}

.compare-toolbar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: .75rem;
    margin: 0 auto .75rem;
    padding: .6rem 1rem;
    background: rgba(255,255,255,.9);
    border: 1px solid var(--ae-border);
    border-radius: 999px;
    backdrop-filter: blur(6px);
    box-shadow: 0 10px 24px rgba(17,24,39,.08);
    width: fit-content;
}

    .compare-toolbar .form-check-input {
        width: 3rem;
        height: 1.6rem;
        cursor: pointer;
        box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
    }

        .compare-toolbar .form-check-input:focus {
            box-shadow: 0 0 0 .2rem var(--ae-ring);
        }

        .compare-toolbar .form-check-input:checked {
            background-color: var(--ae-primary);
            border-color: var(--ae-primary);
        }

    .compare-toolbar .form-check-label {
        margin-left: .5rem;
        font-size: 1.05rem;
    }

@media (max-width:576px) {
    .compare-toolbar {
        padding: .5rem .8rem;
    }

        .compare-toolbar .form-check-input {
            width: 2.5rem;
            height: 1.4rem;
        }

        .compare-toolbar .form-check-label {
            font-size: 1rem;
        }

    .compare-colhead {
        min-width: 280px;
    }

        .compare-colhead .thumb {
            width: 200px;
            height: 136px;
        }
}

/* ============================ COMPARE BAR ============================ */

.compare-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1050;
    background: rgba(255,255,255,.95);
    backdrop-filter: blur(6px);
    border-top: 1px solid var(--ae-border);
    box-shadow: 0 -10px 24px rgba(17,24,39,.08);
}

    /* cap inner width whether container or container-fluid is used */
    .compare-bar .container,
    .compare-bar .container-fluid {
        max-width: 1240px;
        margin: 0 auto;
    }

/* basic layout for inner flex row */
#compareBar .d-flex {
    align-items: center;
    gap: 1rem;
    flex-wrap: nowrap !important;
}

/* title text color */
.compare-bar .fw-semibold {
    color: var(--ae-primary-700);
    white-space: nowrap;
}

/* cards rail */
#compareSlots,
#compareBar .compare-slots {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex: 0 1 auto;
    min-width: 0;
}

/* cards & thumbs in the bar */
.compare-bar .compare-card {
    width: 120px;
    flex: 0 0 auto;
    text-align: center;
}

.compare-bar .compare-thumb {
    width: 120px;
    height: 80px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--ae-border);
    background: #fff;
    display: block;
}

.compare-page-title {
    font-size: 1.75rem; /* bigger than default h4 */
    font-weight: 700; /* bold, premium feel */
    color: var(--ae-primary-700); /* your brand navy */
    margin: 1.5rem 0 1rem; /* balanced spacing */
    text-align: center;
}

.compare-bar .remove-item {
    width: 22px;
    height: 22px;
    line-height: 1;
    padding: 0;
    border-radius: 7px;
    border: 1px solid rgba(0,0,0,.08);
    background: #ef4444;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .compare-bar .remove-item:hover {
        filter: brightness(.95);
    }

#compareGoBtn:not(.disabled) {
    box-shadow: 0 8px 16px rgba(34,76,154,.25);
}

/* reserve space so content isn’t covered by the fixed bar */
body.has-compare-bar {
    padding-bottom: 150px;
}

/* hide arrows by default (desktop) */
#compareBar .compare-nav {
    display: none;
}

/* ============================ MISC / UTIL ============================ */

.compare-scroll {
    border-radius: 12px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}


/* ===== DESKTOP LAYOUT (>= 768px) ===== */
@media (min-width: 768px) {

    /* show desktop title */
    #compareBar .compare-title {
        display: block !important;
    }

    /* show only desktop actions */
    #compareBar .compare-actions-desktop {
        display: flex !important;
    }

    #compareBar .compare-actions-mobile {
        display: none !important;
    }

    /* carousel behaves like normal rail, no arrows */
    #compareBar .compare-carousel {
        flex-grow: 1;
        padding: 0 !important;
        position: relative;
    }

    #compareBar .compare-slots {
        justify-content: center !important;
        overflow-x: visible !important;
        scroll-snap-type: none !important;
        padding: 0 !important;
    }

    /* arrows hidden on desktop */
    #compareBar .compare-nav {
        display: none !important;
    }
}


/* ===== MOBILE LAYOUT (< 768px) ===== */
@media (max-width: 767.98px) {

    /* hide title on mobile */
    #compareBar .compare-title {
        display: none !important;
    }

    /* mobile buttons on top, centered */
    #compareBar .compare-actions-mobile {
        display: flex !important;
        width: 100%;
        justify-content: center;
        margin-bottom: 6px;
    }

    /* hide desktop buttons */
    #compareBar .compare-actions-desktop {
        display: none !important;
    }

    /* carousel full width with space for arrows */
    #compareBar .compare-carousel {
        width: 100%;
        position: relative;
        padding: 0 40px !important; /* space for arrows */
    }

    /* scrollable rail */
    #compareBar .compare-slots {
        overflow-x: auto !important;
        scroll-behavior: smooth;
        scroll-snap-type: x mandatory;
        padding: 4px 0 8px !important;
    }

    /* cards as carousel items */
    #compareBar .compare-card {
        flex: 0 0 140px;
        scroll-snap-align: center;
    }

    /* arrows visible on mobile */
    #compareBar .compare-nav {
        display: flex !important;
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background: #fff;
        border: 1px solid #ccc;
        box-shadow: 0 2px 5px rgba(0,0,0,0.25);
        align-items: center;
        justify-content: center;
        z-index: 10;
    }

    #compareBar .compare-nav-left {
        left: -4px;
    }

    #compareBar .compare-nav-right {
        right: -4px;
    }
}


/* ===== MOBILE TWEAKS: 2 vehicule vizibile în comparație ===== */
/* ===== MOBILE TWEAKS: 2 vehicule vizibile în comparație ===== */
@media (max-width: 576px) {

    /* coloană etichete (Preț, Marcă etc.) mai îngustă */
    .compare-table tbody th {
        min-width: 95px;
        max-width: 95px;
        width: 95px;
        font-size: 0.88rem;
        padding: 0.5rem 0.6rem;
        white-space: normal;
        line-height: 1.3;
    }

    /* coloanele cu vehicule mai înguste ca să încapă 2 */
    .compare-colhead {
        min-width: 140px;
        max-width: 150px;
    }

    .compare-table td {
        font-size: 0.9rem;
        padding: 0.55rem 0.6rem;
        text-align: center;
    }

    /* thumbnail-urile puțin mai mici */
    .compare-colhead .thumb {
        width: 140px;
        height: 96px;
    }
}

/* ===== UNIVERSAL REMOVE BUTTON FOR COMPARE ===== */
.compare-remove-btn {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    border: none;
    padding: 0;
    font-size: 20px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    background: #ef4444; /* red */
    color: #ffffff; /* white X */

    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.25);
    cursor: pointer;
    position: absolute;
    top: -2px;
    right: -24px;
    z-index: 10;
    transition: transform 0.15s ease, background 0.15s ease;
    padding-bottom: 3px; 
}

    .compare-remove-btn:hover {
        background: #dc2626; /* darker red */
        transform: scale(1.32);
    }


.compare-colhead .header-text-box {
    flex-direction: column;
    justify-content: flex-end;
    text-align: center;
}

.thumb-wrapper {
    position: relative;
    display: inline-block; /* so it wraps the image nicely */
}

    .thumb-wrapper .compare-remove-btn {
        position: absolute;
        top: -9px; /* adjust for perfect fit */
        right: -10px;
    }

.compare-details-btn {
    padding: 0.45rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
}

.compare-table td {
    text-align: center;
}