/* padding-bottom trebuie sa fie mai mare decat cei 60px cu care footer-ul (.footer-info)
   se trage in sus peste continut (margin-top:-60px, vezi footer.css) - altfel ultimul
   element de pe pagina (butonul Cumpara) ajunge sub cardul rotunjit al footerului */
.basket-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 100px 16px 80px;
}

.basket-title {
    font-size: 2rem;
    font-weight: bolder;
    margin: 30px 0 24px;
}

/* banner succes comanda */
.basket-success {
    background: #e7f8e1;
    border: 1px solid #3fcc12;
    color: #2f7d12;
    padding: 14px 18px;
    border-radius: 10px;
    font-weight: 600;
    margin-bottom: 24px;
}

.basket-empty {
    color: #777;
    padding: 32px 0;
    font-size: 1.1rem;
}

/* lista produse */
.basket-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.basket-item {
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr) auto auto auto auto;
    grid-template-areas: "image title price qty subtotal remove";
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border: 1px solid #e6e6e6;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .05);
}

/* Plasarea in grid se scopeaza la .basket-item: Purchases.html incarca acelasi css si
   refoloseste clasele .item-*, dar in alt grid (.purchase-item), care nu are aceste
   grid-template-areas. Nescopat, elementele ar ajunge in linii implicite si s-ar suprapune. */
.basket-item .item-image  { grid-area: image; }
.basket-item .item-title  { grid-area: title; }
.basket-item .item-price  { grid-area: price; }
.basket-item .item-qty    { grid-area: qty; }
.basket-item .item-subtotal { grid-area: subtotal; }
.basket-item .item-remove { grid-area: remove; }

.item-image {
    width: 80px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    background: #f2f2f2;
}

.item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.item-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
}

.item-price {
    font-size: 1rem;
    font-weight: 600;
    color: #777;
    white-space: nowrap;
}

/* subtotal pe rand = pret x cantitate (accent) */
.item-subtotal {
    font-size: 1.15rem;
    font-weight: 800;
    color: #482361;
    white-space: nowrap;
    text-align: right;
}

/* camp cantitate */
.item-qty {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.qty-label {
    font-size: .85rem;
    color: #777;
    font-weight: 600;
}

.qty-input {
    width: 64px;
    padding: 8px 8px;
    border: 1px solid #cfcfcf;
    border-radius: 8px;
    font-size: 1rem;
    text-align: center;
}

.qty-input:focus {
    outline: none;
    border-color: #a44edd;
}

.item-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    color: #c0392b;
    border: 1px solid #f0c9c3;
    background: #fff;
    text-decoration: none;
    font-size: 1.05rem;
    transition: background .15s ease, color .15s ease;
}

.item-remove:hover {
    background: #c0392b;
    color: #fff;
}

/* rezumat + finalizare */
.basket-summary {
    margin-top: 28px;
    padding: 20px;
    border: 1px solid #e6e6e6;
    border-radius: 12px;
    background: #faf7fd;
}

.basket-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 1.25rem;
    font-weight: 700;
    padding-bottom: 16px;
    border-bottom: 1px solid #e6ddf0;
    margin-bottom: 16px;
}

.total-value {
    color: #482361;
    font-size: 1.5rem;
    font-weight: 800;
}

.basket-checkout {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.checkout-heading {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    color: #482361;
}

/* alegere persoana fizica / juridica (butoane tip pastila) */
.entity-type {
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
}

.radio-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid #d9c7ea;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
    background: #fff;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
}

.radio-option:has(input:checked) {
    border-color: #a44edd;
    background: #f2e9fb;
    color: #482361;
}

.radio-option input {
    accent-color: #a44edd;
}

/* grid campuri formular: 2 coloane pe desktop */
.checkout-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.checkout-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-label {
    font-weight: 600;
    font-size: .95rem;
}

/* companie/persoana noua: link discret sub select, nu un al doilea buton mare
   langa "Cumpără" */
.checkout-add-company-link {
    display: inline-block;
    align-self: flex-start;
    font-size: .85rem;
    font-weight: 600;
    color: #482361;
    text-decoration: none;
    padding: 8px 0;
    margin-bottom: 4px;
    margin-top: 4px;
}

.checkout-add-company-link:hover {
    text-decoration: underline;
}

.text-input {
    padding: 12px 14px;
    border: 1px solid #cfcfcf;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color .15s ease, background .15s ease;
}

.text-input:focus {
    outline: none;
    border-color: #a44edd;
}

.text-input.invalid {
    border-color: #c0392b;
    background: #fdf3f2;
}

/* mesajul de eroare: ascuns pana la validare */
.form-error {
    display: none;
    color: #c0392b;
    font-size: .9rem;
    font-weight: 600;
}

.form-error.show {
    display: block;
}

.checkout-btn {
    margin-top: 8px;
    align-self: flex-start;
    border: none;
    cursor: pointer;
    padding: 12px 28px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
    background: #a44edd;
    color: #fff;
    transition: background .15s ease;
}

.checkout-btn:hover {
    background: #482361;
}

/* .checkout-btn e folosit si pe <a> (autentificare / creare cont / adauga companie) */
a.checkout-btn {
    display: inline-block;
    text-decoration: none;
    text-align: center;
}

.checkout-btn-outline {
    background: transparent;
    color: #482361;
    border: 1px solid #a44edd;
}

.checkout-btn-outline:hover {
    background: #f2ecf7;
    color: #482361;
}

/* vizitator neautentificat: mesaj + butoane de autentificare / creare cont */
.checkout-auth-hint {
    margin: 0 0 14px;
    color: #555;
    font-size: .95rem;
    line-height: 1.5;
}

.checkout-auth-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

@media (max-width: 480px) {
    .checkout-auth-actions {
        flex-direction: column;
    }

    .checkout-auth-actions .checkout-btn {
        width: 100%;
    }
}

/* tablete: pretul unitar si cantitatea trec pe al doilea rand, sub titlu */
@media (max-width: 768px) {
    .basket-content {
        padding: 88px 16px 72px;
    }

    .basket-item {
        grid-template-columns: 80px minmax(0, 1fr) auto auto;
        grid-template-areas:
            "image title    title    remove"
            "image price    qty      subtotal";
        row-gap: 12px;
    }

    .basket-item .item-subtotal {
        justify-self: end;
    }

    .basket-item .item-remove {
        align-self: start;
        width: 44px;
        height: 44px;
    }
}

/* telefoane: imaginea ramane in stanga, restul se aseaza pe randuri */
@media (max-width: 480px) {
    .basket-content {
        padding: 80px 12px 68px;
    }

    .basket-title {
        font-size: 1.6rem;
    }

    .basket-item {
        grid-template-columns: 64px minmax(0, 1fr) auto;
        grid-template-areas:
            "image title    remove"
            "image price    price"
            "qty   qty      subtotal";
        align-items: center;
        gap: 12px;
        padding: 12px;
    }

    .basket-item .item-image {
        width: 64px;
        height: 64px;
        align-self: start;
    }

    .basket-item .item-price {
        text-align: left;
    }

    .checkout-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    /* pe telefon butonul de finalizare ocupa toata latimea */
    .checkout-btn {
        align-self: stretch;
        width: 100%;
    }

    .basket-summary {
        padding: 16px;
    }

    .basket-total {
        font-size: 1.1rem;
    }

    .total-value {
        font-size: 1.3rem;
    }
}

/* ecrane foarte inguste: cardul se stivuieste complet */
@media (max-width: 380px) {
    .basket-item {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "image  remove"
            "title  title"
            "price  price"
            "qty    subtotal";
    }

    .basket-item .item-image {
        width: 100%;
        height: 120px;
    }

    .entity-type {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
    }

    .radio-option {
        justify-content: center;
    }
}

.item-customization {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px dashed #e6e6e6;
    font-size: .88rem;
    color: #555;
}

.item-customization:empty {
    display: none;
}

.item-customization .cust-key {
    font-weight: 600;
    color: #333;
}
