/* Stiluri custom minime peste Tailwind (CDN). Doar ce nu se poate face cu utilitare. */

html {
    scroll-behavior: smooth;
}

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--accent, #F2C32E);
    outline-offset: 2px;
}

/* Formulare: checkbox-uri si selecturi custom, in stilul site-ului
   (inlocuiesc controalele native de browser, peste tot). */
input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 9999px;
    border: 1px solid #4A4A4A;
    background-color: #2A2A2A;
    cursor: pointer;
    flex-shrink: 0;
    display: inline-grid;
    place-content: center;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

input[type="checkbox"]::before {
    content: '';
    width: 10px;
    height: 10px;
    background-color: transparent;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
    transition: background-color 0.15s ease;
}

input[type="checkbox"]:hover {
    border-color: var(--accent, #F2C32E);
}

input[type="checkbox"]:checked {
    background-color: var(--accent, #F2C32E);
    border-color: var(--accent, #F2C32E);
}

input[type="checkbox"]:checked::before {
    background-color: #0E0E0E;
}

input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--accent, #F2C32E);
    outline-offset: 2px;
}

select {
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 14px;
    cursor: pointer;
}

select option {
    background-color: #222222;
    color: #E5E5E5;
}

/* Autocomplete: browserul (Chrome/Edge) forteaza un fundal deschis la autofill —
   il acoperim cu un box-shadow interior in culoarea inputurilor noastre. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px #2A2A2A inset;
    box-shadow: 0 0 0 1000px #2A2A2A inset;
    -webkit-text-fill-color: #E5E5E5;
    caret-color: #E5E5E5;
    transition: background-color 99999s ease-in-out 0s;
}

/* Dropdown custom (site.js inlocuieste fiecare <select> cu acest component;
   select-ul nativ ramane ascuns in DOM pentru submit si fallback fara JS). */
.custom-select {
    position: relative;
}

.custom-select:has(> #cat-sort) {
    width: fit-content;
    flex-shrink: 0;
}

.custom-select:has(> #cat-sort) .custom-select__label {
    white-space: nowrap;
}

.custom-select__native {
    display: none;
}

.custom-select__trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background-color: #2A2A2A;
    border: 0;
    border-radius: 20px;
    padding: 10px 18px;
    color: #E5E5E5;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.custom-select__trigger:focus-visible {
    outline: 2px solid var(--accent, #F2C32E);
    outline-offset: 2px;
}

.custom-select__trigger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.custom-select__label.is-placeholder {
    color: #6B7280;
}

.custom-select__chevron {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: #9CA3AF;
    transition: transform 0.2s ease;
}

.custom-select.open .custom-select__chevron {
    transform: rotate(180deg);
}

.custom-select__panel {
    position: fixed;          /* ancorat de trigger din JS (positionPanel) ca sa iasa din overflow */
    top: 0;
    left: 0;
    z-index: 120;
    background-color: #1C1C1C;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 6px;
    max-height: 280px;
    overflow: hidden;
    display: none;
    flex-direction: column;
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.55);
}

.custom-select__search {
    flex: none;
    width: 100%;
    margin-bottom: 6px;
    padding: 8px 13px;
    font: inherit;
    font-size: 12.5px;
    color: #E5E5E5;
    background-color: #2A2A2A;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
}

.custom-select__search::placeholder {
    color: #6B7280;
}

.custom-select__search:focus {
    outline: none;
    border-color: var(--accent, #F2C32E);
}

@media (hover: none) and (pointer: coarse) {
    .custom-select__search {
        font-size: 16px;
    }
}

.custom-select__options {
    overflow-y: auto;
    scrollbar-width: thin;                       /* Firefox */
    scrollbar-color: #3A3A3A transparent;        /* Firefox */
}

.custom-select__options::-webkit-scrollbar {
    width: 8px;
}

.custom-select__options::-webkit-scrollbar-track {
    background: transparent;
}

.custom-select__options::-webkit-scrollbar-thumb {
    background-color: #3A3A3A;
    border-radius: 9999px;
    border: 2px solid #1C1C1C;
}

.custom-select__options::-webkit-scrollbar-thumb:hover {
    background-color: #4A4A4A;
}

.custom-select__options::-webkit-scrollbar-button {
    display: none;
}

/* Scrollbar-ul panoului (Chrome/Edge/Safari) — subtire, inchis, fara sageti */
.custom-select__panel::-webkit-scrollbar {
    width: 8px;
}

.custom-select__panel::-webkit-scrollbar-track {
    background: transparent;
}

.custom-select__panel::-webkit-scrollbar-thumb {
    background-color: #3A3A3A;
    border-radius: 9999px;
    border: 2px solid #1C1C1C;
}

.custom-select__panel::-webkit-scrollbar-thumb:hover {
    background-color: #4A4A4A;
}

.custom-select__panel::-webkit-scrollbar-button {
    display: none;
}

.custom-select.open .custom-select__panel {
    display: flex;
}

.custom-select__option {
    padding: 10px 12px;
    border-radius: 6px;
    color: #D1D5DB;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.custom-select__option:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: var(--accent, #F2C32E);
}

.custom-select__option.is-selected {
    color: var(--accent, #F2C32E);
    font-weight: 500;
}

/* Header transparent care devine solid la scroll. Stilurile stau aici (CSS static),
   nu in clase Tailwind adaugate din JS — CDN-ul le-ar compila abia la prima folosire
   si pana atunci border-ul cadea pe culoarea default (flash alb). */
#site-header {
    border-bottom: 1px solid transparent;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

#site-header.is-stuck {
    background: rgba(0, 0, 0, 0.8);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

/* Banda cu logo-uri marci auto — defilare continua, seamless.
   Doua grupuri identice cu acelasi gap intre logo-uri SI intre grupuri (gap pe track),
   iar bucla se inchide exact la o latime-de-grup-plus-un-gap: translateX(calc(-50% - <gap>/2)).
   Asa distanta ultima->prima e EGALA cu cea dintre celelalte logo-uri (fara salt). */
.marquee {
    overflow: hidden;
}

.marquee-track {
    display: flex;
    gap: 40px;
    width: max-content;
    animation: marquee-scroll 45s linear infinite;
    will-change: transform;
}

.marquee-group {
    display: flex;
    align-items: center;
    gap: 40px;
}

.marquee:hover .marquee-track {
    animation-play-state: paused;
}

@keyframes marquee-scroll {
    from { transform: translateX(0); }
    to { transform: translateX(calc(-50% - 20px)); }
}

/* Logo-uri intunecate + acromatice (negru/gri inchis) = invizibile pe banda neagra si par
   "gol"/distanta mare. Le aducem la un argintiu deschis (~#ccc, ca celelalte logo-uri
   metalice), pastrand forma prin alpha. De adaugat aici daca apar alte logo-uri inchise. */
.marquee [data-make="audi"] img,
.marquee [data-make="nissan"] img,
.marquee [data-make="toyota"] img {
    filter: brightness(0) invert(0.8);
}

/* Banda de logo-uri: scrollbar ascuns (pe desktop e overflow:hidden oricum). */
.marquee { scrollbar-width: none; }
.marquee::-webkit-scrollbar { display: none; }

/* Mobil: oprim defilarea automata si lasam banda sa fie derulata cu degetul, ca
   logo-urile (click -> constructor cu marca preselectata) sa fie tinte stabile la tap.
   transform:none reseteaza orice stare de animatie => banda incepe din capatul stang,
   nu "de la mijloc"; al doilea grup e ascuns (fara gap fantoma in stanga). */
@media (max-width: 640px) {
    .marquee { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .marquee-track { animation: none; transform: none; gap: 0; justify-content: flex-start; }
    .marquee-group + .marquee-group { display: none; }
}

/* Cardul de preview al setului, cand "Cu logotip" e activ: inner shadow + border galben,
   iar bara #ctor-logo-hint (sub preview) semnaleaza ca poti plasa logotipul pe covorase. */
#ctor-preview-set.is-logo-active {
    box-shadow: inset 0 0 10px 0px rgba(242, 195, 46, 0.65), inset 0 0 0 1px rgba(242, 195, 46, 0.45);
}

/* Piese restrictionate (ex. tunelul) — nu pot primi logotip. Niciodata clickabile; cand
   "Cu logotip" e activ le estompam ca sa se vada ca nu sunt zone de logo. */
.ctor-set-svg path.restricted {
    pointer-events: none;
    cursor: not-allowed;
}
#ctor-preview-set.is-logo-active .ctor-set-svg path.restricted {
    opacity: 0.4;
}

/* Bara de indicatie pentru logotip: card-latime sub preview, cu o sageata in sus care
   arata spre schita SVG-ului (acolo se apasa ca sa plasezi logotipul). */
.ctor-logo-hint::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-bottom: 7px solid var(--accent, #F2C32E);
}

/* Pagina produs: cuvintele in <b>/<strong> din cardurile de features + descriere = culoarea primara. */
.ws-feature-text b, .ws-feature-text strong,
.ws-product-desc b, .ws-product-desc strong {
    color: var(--accent, #F2C32E);
}

/* Galeria produsului: coloana de thumbnail-uri (stanga) si lightbox popup (click) cu
   drag/pan + zoom + navigare. */
.ws-thumbs { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .18) transparent; }
.ws-thumbs::-webkit-scrollbar { width: 5px; }
.ws-thumbs::-webkit-scrollbar-track { background: transparent; }
.ws-thumbs::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .18); border-radius: 9999px; }

.ws-lb {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .93);
    touch-action: none;
    overscroll-behavior: contain;
}
.ws-lb.hidden { display: none; }
.ws-lb__img {
    max-width: 92vw;
    max-height: 88vh;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    cursor: zoom-in;
    transition: transform .16s ease-out;
    will-change: transform;
}
.ws-lb.is-zoomed .ws-lb__img { cursor: grab; }
.ws-lb.is-panning .ws-lb__img { cursor: grabbing; transition: none; }
.ws-lb__close {
    position: absolute;
    top: 16px;
    right: 18px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 9999px;
    background: rgba(255, 255, 255, .1);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    transition: background .15s;
}
.ws-lb__close:hover { background: rgba(255, 255, 255, .22); }
.ws-lb__counter {
    position: absolute;
    top: 22px;
    left: 20px;
    color: rgba(255, 255, 255, .75);
    font-size: 13px;
    letter-spacing: .04em;
}
.ws-lb__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 9999px;
    background: rgba(255, 255, 255, .1);
    color: #fff;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}
.ws-lb__nav:hover { background: rgba(255, 255, 255, .22); }
.ws-lb__prev { left: 16px; }
.ws-lb__next { right: 16px; }
@media (max-width: 640px) {
    .ws-lb__nav { width: 40px; height: 40px; font-size: 24px; }
    .ws-lb__prev { left: 8px; }
    .ws-lb__next { right: 8px; }
}

/* Coloana dreapta a constructorului: shadow sticky in cap, vizibil doar cand s-a defilat
   (clasa .is-scrolled adaugata din JS). Culoarea = fundalul modalului (#161616). */
.ctor-scroll-shadow {
    position: sticky;
    top: 0;
    height: 0;
    z-index: 20;
}
.ctor-scroll-shadow::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 26px;
    background: linear-gradient(to bottom, #161616 15%, rgba(22, 22, 22, 0) 100%);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}
.ctor-scroll-col.is-scrolled .ctor-scroll-shadow::after {
    opacity: 1;
}

/* Scrollbar-ul zonei scrolabile din modal — scos in evidenta: thumb culoarea primara
   (galben) pe track culoarea secundara (#222), mai lat ca sa se vada ca-i scrolabil. */
.ctor-modal-scroll {
    scrollbar-width: thin;                              /* Firefox */
    scrollbar-color: var(--accent, #F2C32E) #222222;    /* Firefox: thumb / track */
}
.ctor-modal-scroll::-webkit-scrollbar {
    width: 10px;
}
.ctor-modal-scroll::-webkit-scrollbar-track {
    background: #222222;
    border-radius: 9999px;
}
.ctor-modal-scroll::-webkit-scrollbar-thumb {
    background-color: var(--accent, #F2C32E);
    border-radius: 9999px;
    border: 2px solid #222222;
}
.ctor-modal-scroll::-webkit-scrollbar-thumb:hover {
    background-color: #D9AD1F;
}
.ctor-modal-scroll::-webkit-scrollbar-button {
    display: none;
}

/* Rezerva mereu latimea scrollbar-ului in coloana de pasi, ca sa nu "sara" continutul
   spre stanga cand apare scrollbar-ul (la trecerea din nescrolabil in scrolabil). */
#ctor-steps-col {
    scrollbar-gutter: stable;
}

/* Pe mobil/tableta (sub lg) constructorul nu mai are scroll intern, iar scrollbar-ul
   galben nu trebuie sa fie vizibil nicaieri in modal. */
@media (max-width: 1023px) {
    .ctor-modal-scroll { scrollbar-width: none; }
    .ctor-modal-scroll::-webkit-scrollbar { display: none; }
    #ctor-steps-col { scrollbar-gutter: auto; }
}

/* (D) Preview-ul constructorului pe mobil: mutat din JS intre pasul Logotip si Portbagaj,
   2 coloane (foto + schita set) pe un rand, intr-un card. Lipit jos (sticky) cat timp
   pozitia lui e sub ecran, se aseaza la loc cand ajungi la el. Apare doar dupa ce s-a
   ales un set (clasa .ctor-has-set pusa pe #constructor-modal din constructor.js). */
@media (max-width: 1023px) {
    #ctor-preview-wrap.ctor-prev-mobile {
        display: none;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        position: sticky;
        bottom: 8px;
        z-index: 15;
        background: #161616;
        border-radius: 16px;
        padding: 8px;
        box-shadow: 0 6px 28px rgba(0, 0, 0, 0.55);
    }
    .ctor-has-set #ctor-preview-wrap.ctor-prev-mobile { display: grid; }
    #ctor-preview-wrap.ctor-prev-mobile > #ctor-photo-box,
    #ctor-preview-wrap.ctor-prev-mobile > #ctor-preview-set {
        height: 125px;
        background: #1C1C1C;
    }

    /* Alerta de logotip pe mobil: bara cat ambele coloane (rand nou in grid), sub ele;
       sageata mutata sub coloana SVG (dreapta), acolo unde se plaseaza logotipul. */
    #ctor-preview-wrap.ctor-prev-mobile > #ctor-logo-hint {
        grid-column: 1 / -1;
    }
    #ctor-preview-wrap.ctor-prev-mobile > #ctor-logo-hint::before {
        left: 74%;
    }

    /* Coloana stanga (preview + butoane) e relocata in fluxul pasilor pe mobil -> ascunsa. */
    #ctor-left-col.ctor-col-moved { display: none; }

    /* Swatch-urile de culoare: 7 pe rand (grid) in loc de flex-wrap cu 5. */
    #ctor-mats, #ctor-borders, #ctor-trunk-mats, #ctor-trunk-borders {
        display: grid;
        grid-template-columns: repeat(7, minmax(0, 1fr));
        gap: 6px;
    }
    #ctor-mats .ctor-swatch, #ctor-borders .ctor-swatch,
    #ctor-trunk-mats .ctor-swatch, #ctor-trunk-borders .ctor-swatch {
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1;
    }
}

/* Umbra de sus a zonei scrolabile a constructorului: continutul se estompeaza sub titlu,
   ca sa nu fie taiat brusc. Element de 0px lipit intre header si grid, gradient in jos. */
.ctor-grid-shadow {
    position: relative;
    height: 0;
    z-index: 18;
    pointer-events: none;
}
.ctor-grid-shadow::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 22px;
    background: linear-gradient(to bottom, #161616 35%, rgba(22, 22, 22, 0) 100%);
}

/* Efect de deschidere a modalului constructor: zoom usor din centru. */
@keyframes ctorZoomIn {
    from { opacity: 0; transform: scale(0.94); }
    to { opacity: 1; transform: scale(1); }
}
.ctor-zoom-in { animation: ctorZoomIn 0.22s ease-out; }
