/* ==========================================================================
   Comparator de produse
   Foloseste tokenii din newNavbar.phtml; fallback-urile de mai jos tin
   componenta corecta si daca se incarca pe o pagina fara tokeni definiti.
   ========================================================================== */

.avs-cmp,
.avs-cmp-bar,
.avs-cmp-add {
    --cmp-bg: var(--clr-black, #1C1C1C);
    --cmp-card: var(--clr-cardgrey, #2B2C2E);
    --cmp-border: var(--clr-border, #2B2C2E);
    --cmp-text: var(--clr-almostwhite, #EEEEEE);
    --cmp-muted: var(--clr-lightgrey, #ACAAAA);
    --cmp-dim: var(--clr-darkgrey, #675F5D);
    --cmp-accent: var(--clr-orange, #F16A52);
    --cmp-blue: var(--clr-blue, #49B2E3);
    --cmp-ff: var(--ff-hg, 'hanken-grotesk', Arial, sans-serif);
    --cmp-ff-title: var(--ff-aga, 'alternate-gothic-atf', Impact, sans-serif);
    --cmp-col: 240px;
    --cmp-label: 220px;
}

/* ==========================================================================
   1. Buton "Compara" (card listare + pagina produs)
   ========================================================================== */

.avs-cmp-add {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border: 1px solid var(--cmp-border);
    border-radius: 50px;
    background: transparent;
    color: var(--cmp-muted);
    font-family: var(--cmp-ff);
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}

.avs-cmp-add:hover {
    border-color: var(--cmp-muted);
    color: var(--cmp-text);
    text-decoration: none;
}

.avs-cmp-add svg {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
}

.avs-cmp-add svg path {
    fill: currentColor;
}

/* starea "adaugat" */
.avs-cmp-add.is-added {
    border-color: var(--cmp-accent);
    color: var(--cmp-accent);
}

.avs-cmp-add.is-added .avs-cmp-add__on {
    display: inline;
}

.avs-cmp-add.is-added .avs-cmp-add__off {
    display: none;
}

.avs-cmp-add__on {
    display: none;
}

.avs-cmp-add.is-busy {
    opacity: .55;
    pointer-events: none;
}

/* varianta patrata, langa adauga-in-cos / wishlist pe pagina de produs:
   doar iconita, aceeasi geometrie ca butonul de wishlist (51x53) */
/* display:block, exact ca #favourite - intr-un context flex dimensionarea
   procentuala a SVG-ului nu se rezolva corect si iconita iese mai mica */
.avs-cmp-add--sq {
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: none;
    border-radius: 0;
    background: none;
    color: #F5F5F5;
    line-height: 0;
}

/* dimensiuni fixe, ca la #favourite: procentele nu se rezolva aici si
   iconita iesea mai mica decat patratul */
.avs-cmp-add--sq svg {
    display: block;
    width: 51px;
    height: 53px;
    flex: none;
}

.avs-cmp-add--sq svg rect {
    stroke: currentColor;
}

.avs-cmp-add--sq svg path {
    fill: currentColor;
}

.avs-cmp-add--sq:hover,
.avs-cmp-add--sq.is-added {
    color: var(--cmp-accent);
}

/* ==========================================================================
   2. Bara flotanta
   ========================================================================== */

.avs-cmp-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1400;
    background: var(--cmp-card);
    border-top: 1px solid rgba(255, 255, 255, .08);
    box-shadow: 0 -8px 28px rgba(0, 0, 0, .45);
    transform: translateY(110%);
    transition: transform .25s ease;
    font-family: var(--cmp-ff);
}

.avs-cmp-bar.is-open {
    transform: translateY(0);
}

.avs-cmp-bar__inner {
    max-width: 1600px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 18px;
}

.avs-cmp-bar__label {
    flex: 0 0 auto;
    font-family: var(--cmp-ff-title);
    font-size: 20px;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--cmp-text);
}

.avs-cmp-bar__label span {
    color: var(--cmp-accent);
}

.avs-cmp-bar__items {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    overflow-x: auto;
    scrollbar-width: thin;
    /* overflow-x:auto face si overflow-y sa taie, iar butonul X iese din
       cutia thumbnail-ului - padding-ul ii lasa loc sa se vada intreg */
    padding: 9px 9px 3px 3px;
}

.avs-cmp-bar__item {
    position: relative;
    flex: 0 0 auto;
    width: 62px;
    height: 62px;
    border: 1px solid var(--cmp-border);
    border-radius: 6px;
    background: #fff;
    padding: 5px;
}

.avs-cmp-bar__item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.avs-cmp-bar__item .avs-cmp-bar__rm {
    position: absolute;
    top: -7px;
    right: -7px;
    width: 19px;
    height: 19px;
    border: none;
    border-radius: 50%;
    background: var(--cmp-accent);
    color: #fff;
    font-size: 12px;
    line-height: 19px;
    text-align: center;
    cursor: pointer;
    padding: 0;
}

/* sloturi goale, pana la maximul permis */
.avs-cmp-bar__slot {
    flex: 0 0 auto;
    width: 62px;
    height: 62px;
    border: 1px dashed var(--cmp-dim);
    border-radius: 6px;
    opacity: .5;
}

.avs-cmp-bar__actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.avs-cmp-bar__go {
    display: inline-block;
    padding: 13px 28px;
    border-radius: 50px;
    background: var(--cmp-accent);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

/* specificitate ridicata + toate starile de link, ca sa nu fie suprascris
   textul de regulile globale pentru <a> si sa ramana alb pe fundalul portocaliu */
.avs-cmp-bar .avs-cmp-bar__go,
.avs-cmp-bar .avs-cmp-bar__go:link,
.avs-cmp-bar .avs-cmp-bar__go:visited,
.avs-cmp-bar .avs-cmp-bar__go:hover,
.avs-cmp-bar .avs-cmp-bar__go:focus,
.avs-cmp-bar .avs-cmp-bar__go:active {
    color: #fff;
    text-decoration: none;
}

.avs-cmp-bar .avs-cmp-bar__go:hover {
    filter: brightness(1.08);
}

.avs-cmp-bar__clear {
    border: none;
    background: none;
    color: var(--cmp-muted);
    font-family: var(--cmp-ff);
    font-size: 13px;
    text-decoration: underline;
    cursor: pointer;
    white-space: nowrap;
}

.avs-cmp-bar__clear:hover {
    color: var(--cmp-text);
}

/* ==========================================================================
   3. Pagina de comparatie
   ========================================================================== */

.avs-cmp {
    width: 100%;
    font-family: var(--cmp-ff);
    color: var(--cmp-text);
}

.avs-cmp__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 22px;
}

.avs-cmp__title {
    font-family: var(--cmp-ff-title);
    font-size: 34px;
    line-height: 1.1;
    letter-spacing: .5px;
    text-transform: uppercase;
    margin: 0;
    color: var(--cmp-text);
}

.avs-cmp__title small {
    display: block;
    font-family: var(--cmp-ff);
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
    color: var(--cmp-muted);
    margin-top: 6px;
}

.avs-cmp__tools {
    display: flex;
    align-items: center;
    gap: 18px;
}

/* toggle "doar diferentele" */
.avs-cmp__toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: var(--cmp-muted);
    user-select: none;
}

.avs-cmp__toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.avs-cmp__switch {
    width: 38px;
    height: 21px;
    border-radius: 50px;
    background: var(--cmp-dim);
    position: relative;
    transition: background-color .18s ease;
    flex: 0 0 auto;
}

.avs-cmp__switch::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #fff;
    transition: transform .18s ease;
}

.avs-cmp__toggle input:checked+.avs-cmp__switch {
    background: var(--cmp-accent);
}

.avs-cmp__toggle input:checked+.avs-cmp__switch::after {
    transform: translateX(17px);
}

.avs-cmp__toggle input:focus-visible+.avs-cmp__switch {
    outline: 2px solid var(--cmp-blue);
    outline-offset: 2px;
}

.avs-cmp__back {
    font-size: 14px;
    color: var(--cmp-muted);
    text-decoration: none;
}

.avs-cmp__back:hover {
    color: var(--cmp-text);
    text-decoration: underline;
}

/* --- containerul cu scroll orizontal --- */
.avs-cmp__scroll {
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--cmp-dim) transparent;
}

.avs-cmp__scroll::-webkit-scrollbar {
    height: 9px;
}

.avs-cmp__scroll::-webkit-scrollbar-thumb {
    background: var(--cmp-dim);
    border-radius: 50px;
}

.avs-cmp__table {
    border-collapse: separate;
    border-spacing: 0;
    width: auto;
    min-width: 100%;
    table-layout: fixed;
}

.avs-cmp__table th,
.avs-cmp__table td {
    vertical-align: top;
    text-align: left;
    padding: 13px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    width: var(--cmp-col);
    font-size: 14px;
    line-height: 1.5;
}

/* prima coloana ramane lipita la stanga */
.avs-cmp__table .avs-cmp__rowhead {
    position: sticky;
    left: 0;
    z-index: 2;
    width: var(--cmp-label);
    min-width: var(--cmp-label);
    background: var(--cmp-bg);
    color: var(--cmp-muted);
    font-weight: 500;
    border-right: 1px solid rgba(255, 255, 255, .07);
}

/* randul cu produsele ramane lipit sus */
.avs-cmp__table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--cmp-bg);
    padding: 0;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.avs-cmp__table thead th.avs-cmp__rowhead {
    z-index: 4;
}

/* --- cardul de produs din capul tabelului --- */
.avs-cmp__product {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 18px 18px;
    height: 100%;
}

.avs-cmp__product--empty {
    justify-content: center;
}

.avs-cmp__thumb {
    display: block;
    width: 100%;
    height: 118px;
    background: #fff;
    border-radius: 6px;
    padding: 9px;
}

.avs-cmp__thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.avs-cmp__name {
    color: var(--cmp-text);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    text-decoration: none;
    display: block;
}

.avs-cmp__name:hover {
    color: var(--cmp-accent);
    text-decoration: none;
}

.avs-cmp__price {
    font-family: var(--cmp-ff-title);
    font-size: 23px;
    letter-spacing: .5px;
    color: var(--cmp-text);
    display: flex;
    align-items: baseline;
    gap: 5px;
}

.avs-cmp__price .avs-cmp__cur {
    font-family: var(--cmp-ff);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    color: var(--cmp-muted);
}

.avs-cmp__from,
.avs-cmp__mu {
    font-family: var(--cmp-ff);
    font-size: 12px;
    font-weight: 400;
    color: var(--cmp-muted);
}

.avs-cmp__rm {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    border: 1px solid var(--cmp-border);
    border-radius: 50%;
    background: var(--cmp-bg);
    color: var(--cmp-muted);
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avs-cmp__rm:hover {
    border-color: var(--cmp-accent);
    color: var(--cmp-accent);
    text-decoration: none;
}

/* --- capul de grup de atribute --- */
.avs-cmp__group th {
    position: sticky;
    left: 0;
    background: var(--cmp-card);
    font-family: var(--cmp-ff-title);
    font-size: 17px;
    letter-spacing: .6px;
    text-transform: uppercase;
    color: var(--cmp-text);
    padding: 11px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
}

/* --- valori --- */
.avs-cmp__val {
    color: var(--cmp-text);
    word-break: break-word;
}

.avs-cmp__val--empty {
    color: var(--cmp-dim);
}

/* randurile in care produsele difera */
.avs-cmp__row--diff .avs-cmp__val {
    color: #fff;
}

.avs-cmp__row--diff .avs-cmp__rowhead {
    box-shadow: inset 3px 0 0 var(--cmp-accent);
    color: var(--cmp-text);
}

/* ascunde randurile identice cand e activ filtrul */
.avs-cmp.is-diffonly .avs-cmp__row--same {
    display: none;
}

/* grupurile ramase fara randuri vizibile */
.avs-cmp.is-diffonly .avs-cmp__group.is-hidden {
    display: none;
}

.avs-cmp__nodiff {
    display: none;
    padding: 26px 18px;
    color: var(--cmp-muted);
    font-size: 14px;
}

.avs-cmp.is-diffonly.has-no-diff .avs-cmp__nodiff {
    display: block;
}

/* --- stare goala --- */
.avs-cmp__empty {
    padding: 70px 20px;
    text-align: center;
}

.avs-cmp__empty h2 {
    font-family: var(--cmp-ff-title);
    font-size: 27px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--cmp-text);
    margin: 0 0 12px;
}

.avs-cmp__empty p {
    color: var(--cmp-muted);
    font-size: 15px;
    margin: 0 0 24px;
}

.avs-cmp__empty a {
    display: inline-block;
    padding: 13px 28px;
    border-radius: 50px;
    background: var(--cmp-accent);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.avs-cmp .avs-cmp__empty a,
.avs-cmp .avs-cmp__empty a:link,
.avs-cmp .avs-cmp__empty a:visited,
.avs-cmp .avs-cmp__empty a:hover,
.avs-cmp .avs-cmp__empty a:focus {
    color: #fff;
    text-decoration: none;
}

.avs-cmp .avs-cmp__empty a:hover {
    filter: brightness(1.08);
}

/* wrapper-ul paginii de comparatie */
#comparator {
    width: 100%;
    padding: 24px 0 120px;
}

#content .cnt-1.bd #comparator {
    max-width: 1600px;
    margin: 0 auto;
}

/* ==========================================================================
   4. Responsive
   ========================================================================== */

@media screen and (max-width: 1030px) {
    .avs-cmp-bar__inner {
        padding: 11px 12px;
        gap: 12px;
    }

    .avs-cmp-bar__label {
        display: none;
    }

    .avs-cmp-bar__go {
        padding: 11px 18px;
        font-size: 13px;
    }

    .avs-cmp-bar__clear {
        display: none;
    }
}

@media screen and (max-width: 762px) {
    .avs-cmp {
        --cmp-col: 168px;
        --cmp-label: 112px;
    }

    .avs-cmp__title {
        font-size: 25px;
    }

    .avs-cmp__head {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
        margin-bottom: 16px;
    }

    /* toggle-ul si linkul inapoi pe acelasi rand, cu spatiu de atins */
    .avs-cmp__tools {
        width: 100%;
        justify-content: space-between;
        gap: 12px;
    }

    .avs-cmp__toggle,
    .avs-cmp__back {
        min-height: 40px;
        display: inline-flex;
        align-items: center;
    }

    .avs-cmp__table th,
    .avs-cmp__table td {
        padding: 10px 11px;
        font-size: 13px;
    }

    .avs-cmp__group th {
        font-size: 15px;
        padding: 9px 11px;
    }

    .avs-cmp__product {
        padding: 11px;
        gap: 6px;
    }

    .avs-cmp__thumb {
        height: 80px;
        padding: 6px;
    }

    .avs-cmp__name {
        font-size: 13px;
    }

    .avs-cmp__price {
        font-size: 18px;
    }

    /* tinta de atins mai mare pentru scoaterea din comparatie */
    .avs-cmp__rm {
        width: 28px;
        height: 28px;
        top: 7px;
        right: 7px;
    }

    .avs-cmp__empty {
        padding: 48px 16px;
    }

    .avs-cmp__empty h2 {
        font-size: 22px;
    }

    /* butonul din listare: tinta comoda, fara sa rupa randul */
    .avs-cmp-add {
        min-height: 38px;
        padding: 9px 14px;
    }
}

/* --- bara, pe telefon: thumbnail-urile pe un rand, actiunea pe tot latul --- */
@media screen and (max-width: 640px) {
    .avs-cmp-bar__inner {
        flex-wrap: wrap;
        gap: 8px;
        padding: 8px 12px;
        /* nu intram sub bara de gesturi pe iPhone */
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    }

    .avs-cmp-bar__items {
        flex: 1 1 100%;
        width: 100%;
        padding: 9px 9px 3px 3px;
    }

    .avs-cmp-bar__item,
    .avs-cmp-bar__slot {
        width: 52px;
        height: 52px;
    }

    /* pe mobil sloturile goale doar incarca bara */
    .avs-cmp-bar__slot {
        display: none;
    }

    .avs-cmp-bar__item .avs-cmp-bar__rm {
        width: 22px;
        height: 22px;
        line-height: 22px;
        font-size: 14px;
    }

    .avs-cmp-bar__actions {
        flex: 1 1 100%;
        width: 100%;
    }

    .avs-cmp-bar__go {
        width: 100%;
        text-align: center;
        padding: 14px 20px;
        font-size: 14px;
    }

    /* bara e mai inalta pe doua randuri - lasam continutul vizibil */
    #comparator {
        padding-bottom: 185px;
    }
}
