﻿:root {
    --brand-red: #C10206;
    --brand-red-dark: #a00003;
    --brand-gray: #6b7280;
    --brand-light-gray: #f9fafb;
    --brand-border: #d1d5db;
    --brand-text: #1f2937;
    --brand-success: #10b981;
    --brand-error: #dc2626;
    --brand-blue: #3b82f6;
}

/* Container scroll compact */
.checkout-scroll-container {
    flex-grow: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 80px; /* Spațiu pentru footer sticky */
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: var(--brand-border) transparent;
}

    .checkout-scroll-container::-webkit-scrollbar {
        width: 5px;
    }

    .checkout-scroll-container::-webkit-scrollbar-thumb {
        background-color: var(--brand-border);
        border-radius: 3px;
    }

/* Tranziții între view-uri */
#checkout-view, #confirmation-view {
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
    padding: 0 14px; /* Padding specific checkout/confirm view */
}

#cart-view {
    opacity: 1;
    transform: translateX(0);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
    /* Padding-ul pentru cart-view este gestionat în cart.css */
}

#cosLateral.checkout-active #cart-view,
#cosLateral.confirmation-active #cart-view,
#cosLateral.confirmation-active #checkout-view {
    opacity: 0;
    transform: translateX(-30px);
    pointer-events: none;
    position: absolute;
    width: 100%;
}

#cosLateral.checkout-active #checkout-view,
#cosLateral.confirmation-active #confirmation-view {
    opacity: 1;
    transform: translateX(0);
    position: static;
    pointer-events: auto;
}

/* STILURI PENTRU RADIO BUTTONS PERSOANĂ FIZICĂ/JURIDICĂ */
.person-type-selection {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 10px 0 15px 0;
    border-bottom: 1px solid var(--brand-border);
    padding-bottom: 10px;
}

.person-type-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--brand-gray);
    transition: color 0.2s ease;
}

    .person-type-option input[type="radio"] {
        margin-right: 5px;
        width: 15px;
        height: 15px;
        accent-color: var(--brand-red);
        cursor: pointer;
    }

        .person-type-option input[type="radio"]:checked + span {
            color: var(--brand-red);
            font-weight: 700;
        }

/* STILURI FLOATING LABELS */
.person-form {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

    .person-form[hidden] {
        display: none;
    }

/* Form groups cu floating labels */
.form-group {
    position: relative;
    margin-bottom: 6px; /* <-- Redus */
}

    /* Padding vertical FOARTE redus pentru AMBELE */
    .form-group input,
    .form-group textarea {
        width: 100%;
        padding: 0.6rem 0.7rem 0.1rem 0.7rem; /* <-- Redus drastic */
        font-size: 0.9rem;
        font-family: inherit;
        color: var(--brand-text);
        background-color: #fff;
        border: 1px solid var(--brand-border);
        border-radius: 5px;
        box-sizing: border-box;
        transition: border-color 0.2s ease;
        resize: vertical;
        min-height: 38px; /* <-- Redus */
    }

    .form-group textarea {
        padding-top: 1.1rem; /* Mărim padding-ul superior la 1.1rem */
    }

    /* Stil specific textarea */
    .form-group textarea {
        line-height: 1.3;
    }

        /* Ascundem placeholder-ul default */
        .form-group input::placeholder,
        .form-group textarea::placeholder {
            color: transparent; /* Asigură-te că aceasta există */
        }

    /* Eticheta generală (aplicată la ambele) */
    .form-group label {
        position: absolute;
        top: 0.1rem; /* <-- Redus FOARTE mult */
        left: 0.75rem;
        font-size: 0.9rem;
        color: var(--brand-gray);
        pointer-events: none;
        transition: all 0.2s ease;
        background-color: #fff; /* Fundal alb pt a acoperi bordura */
        padding: 0 2px; /* Spațiu mic stânga/dreapta */
        z-index: 1; /* Peste input */
        line-height: 1.3; /* Păstrăm line-height redus */
    }

    /* Regula specifică textarea+label nu mai este necesară */

    /* Label animat când urcă (rămâne la fel) */
    .form-group input:focus + label,
    .form-group input:not(:placeholder-shown) + label,
    .form-group textarea:focus + label,
    .form-group textarea:not(:placeholder-shown) + label,
    .form-group.has-value label {
        top: -0.45rem; /* Poziția când e SUS */
        left: 0.6rem;
        font-size: 0.7rem; /* Mărime mică sus */
        color: var(--brand-red);
        font-weight: 500;
    }

    /* Focus styles */
    .form-group input:focus,
    .form-group textarea:focus {
        outline: none;
        border-color: var(--brand-red);
        box-shadow: 0 0 0 2px rgba(193, 2, 6, 0.1);
    }

/* Stiluri validare erori */
.validation-error {
    color: var(--brand-error);
    font-size: 0.7rem;
    font-weight: 500;
    margin-top: 1px;
    padding-left: 4px;
    display: none; /* Ascuns by default */
    min-height: 1em; /* Rezervă spațiu minim */
}

.form-group.has-error input,
.form-group.has-error textarea {
    border-color: var(--brand-error);
    background-color: #fef2f2;
}

.form-group.has-error .validation-error {
    display: block; /* Afișat când e eroare */
}

.form-group.has-error label {
    color: var(--brand-error);
}

/* Acordeon sumar compact */
.order-summary-accordion {
    border: 1px solid var(--brand-border);
    border-radius: 8px;
    margin: 12px 0 10px 0; /* Spațiere sus/jos */
    background-color: var(--brand-light-gray);
    flex-shrink: 0; /* Nu se micșorează */
}

.order-summary-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 10px 14px; /* Padding interior buton acordeon */
    background: none;
    border: none;
    border-bottom: 1px solid var(--brand-border); /* Linie sub toggle când e închis */
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
}

    .order-summary-toggle[aria-expanded="true"] {
        border-bottom-color: transparent; /* Scoate linia când e deschis */
    }

.summary-toggle-left {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--brand-text);
}

    .summary-toggle-left .cart-icon-summary { /* Stil iconiță coș din toggle */
        width: 16px;
        height: 16px;
        color: var(--brand-gray);
    }


.summary-toggle-right {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--brand-red);
    font-weight: 700;
    flex-shrink: 0;
}

    .summary-toggle-right .chevron-icon { /* Stil iconiță săgeată */
        transition: transform 0.3s ease;
        color: var(--brand-gray);
        width: 14px;
        height: 14px;
    }

.order-summary-toggle[aria-expanded="true"] .chevron-icon {
    transform: rotate(180deg);
}

/* Conținut acordeon (ascuns inițial) */
.order-summary-content {
    padding: 0 14px; /* Padding doar stânga/dreapta inițial */
    background-color: #fff;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, opacity 0.3s 0.1s ease-out, padding 0.4s ease-out;
}
    /* Stil când conținutul e vizibil */
    .order-summary-content.active {
        max-height: 500px; /* Valoare suficient de mare */
        opacity: 1;
        padding: 14px; /* Adaugă padding sus/jos */
    }
/* Stiluri pentru lista de produse din sumar */
#summary-items-list .summary-item {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #eee;
    font-size: 0.85rem;
}

    #summary-items-list .summary-item:last-child {
        border-bottom: none;
        margin-bottom: 0;
        padding-bottom: 0;
    }

    #summary-items-list .summary-item img {
        width: 45px;
        height: 45px;
        object-fit: cover;
        border-radius: 4px;
        border: 1px solid #eee;
    }

#summary-items-list .summary-item-details {
    flex-grow: 1;
}

#summary-items-list .summary-item-name {
    font-weight: 600;
    display: block;
    margin-bottom: 2px;
    color: #333;
}

#summary-items-list .summary-item-price-qty {
    color: #666;
    font-size: 0.75rem;
}

#summary-items-list .summary-item-total {
    font-weight: 600;
    white-space: nowrap;
    color: #333;
    align-self: center;
}
/* Stiluri pentru totalurile din sumar */
.summary-totals {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
    font-size: 0.9rem;
}

    .summary-totals div {
        display: flex;
        justify-content: space-between;
        margin-bottom: 4px;
        color: #444;
    }

    .summary-totals span:last-child {
        font-weight: 600;
    }

    .summary-totals #summary-shipping {
        color: var(--brand-red);
    }

/* === STILURI NOI PENTRU SECȚIUNEA EXPANDABILĂ === */
.optional-details-section {
    margin-top: 10px; /* Spațiu deasupra butonului */
    border-top: 1px dashed var(--brand-border); /* Linie separatoare */
    padding-top: 10px; /* Spațiu sub linie */
}

.optional-details-toggle {
    background: none;
    border: none;
    color: var(--brand-blue); /* Culoare text buton */
    font-weight: 500;
    font-size: 0.85rem; /* Mărime text buton */
    cursor: pointer;
    padding: 0;
    margin-bottom: 8px; /* Spațiu sub buton când e extins */
    display: flex;
    align-items: center;
    gap: 4px; /* Spațiu între iconiță și text */
    width: 100%; /* Ocupă toată lățimea */
    text-align: left; /* Aliniere text */
}

    .optional-details-toggle .toggle-icon {
        width: 16px; /* Mărime iconiță */
        height: 16px;
        transition: transform 0.3s ease; /* Animație rotire iconiță */
        flex-shrink: 0; /* Nu micșora iconița */
    }

    .optional-details-toggle[aria-expanded="true"] .toggle-icon {
        transform: rotate(45deg); /* Rotește iconița "+" într-un "x" simplu */
    }

.optional-details-content {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.2s ease-out, margin-top 0.3s ease-out;
    margin-top: 0;
}
    /* Stiluri când conținutul este vizibil */
    .optional-details-content.expanded {
        max-height: 400px; /* Valoare suficient de mare */
        opacity: 1;
        margin-top: 4px; /* Spațiu mic între buton și conținut */
    }

/* Stiluri specifice pentru conținutul expandabil */
#optional-content .form-group {
    margin-bottom: 10px; /* Refacem puțin spațiul între câmpurile opționale */
}

    #optional-content .form-group:last-child {
        margin-bottom: 0; /* Ultimul element nu are margine jos */
    }

/* Titlu Cod Promo */
.promo-code-title {
    font-size: 0.8rem;
    font-weight: 600;
    margin: 10px 0 6px 0;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
/* Grup Input Cod Promo + Buton */
.promo-input-group {
    display: flex;
    gap: 6px; /* Spațiu între input și buton */
    margin-bottom: 6px; /* Spațiu sub grup */
}

    .promo-input-group input {
        flex-grow: 1; /* Inputul ocupă spațiul rămas */
        /* Folosește stilurile standard de input, dar poate cu padding puțin mai mic */
        padding: 0.5rem 0.6rem 0.1rem 0.6rem;
        font-size: 0.85rem;
        min-height: 36px;
        /* Asigură că stilurile de bază sunt aplicate */
        font-family: inherit;
        color: var(--brand-text);
        background-color: #fff;
        border: 1px solid var(--brand-border);
        border-radius: 5px;
        box-sizing: border-box;
        transition: border-color 0.2s ease;
    }

        .promo-input-group input::placeholder {
            color: var(--brand-gray);
        }

        .promo-input-group input:focus {
            outline: none;
            border-color: var(--brand-red);
            box-shadow: 0 0 0 2px rgba(193, 2, 6, 0.1);
        }


/* Buton Aplică Cod Promo */
.btn-apply-promo {
    padding: 0 0.9rem; /* Padding orizontal, vertical preluat din înălțime */
    height: 36px; /* Aceeași înălțime ca inputul */
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
    background-color: var(--brand-blue); /* Albastru pentru acțiune secundară */
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
    flex-shrink: 0; /* Nu se micșorează */
    text-transform: uppercase;
    line-height: 36px; /* Centrează textul vertical */
}

    .btn-apply-promo:hover {
        background-color: #2563eb;
    }

    .btn-apply-promo:disabled {
        background-color: var(--brand-gray);
        cursor: not-allowed;
        opacity: 0.7;
    }

/* Feedback Cod Promo */
#promo-feedback {
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 4px;
    min-height: 1.1em; /* Rezervă spațiu */
    color: var(--brand-gray); /* Culoare default */
}

    #promo-feedback.success {
        color: var(--brand-success);
    }

    #promo-feedback.error {
        color: var(--brand-error);
    }


/* Wrapper pentru Plată/Livrare și Total */
.payment-shipping-total-info {
    margin-top: 15px; /* Spațiu deasupra secțiunii */
    display: flex;
    justify-content: space-between; /* Aliniază la stânga și dreapta */
    align-items: flex-end; /* Aliniază elementele la bază */
}

/* Info plată/livrare compact */
.payment-shipping-compact {
    display: flex;
    flex-direction: column; /* Unul sub altul */
    gap: 1px; /* Spațiu mic între rânduri */
    margin-bottom: 0; /* Fără margine jos aici */
}

.compact-info-item {
    font-size: 0.7rem; /* Foarte mic */
    color: var(--brand-gray);
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 3px;
}

    .compact-info-item strong {
        color: var(--brand-text);
    }

/* TOTAL COMPACT */
.order-total-compact {
    padding: 0; /* Fără padding extra */
    margin-bottom: 0; /* Fără margine jos aici */
    text-align: right; /* Asigură alinierea la dreapta */
    border-top: none; /* Fără bordură sus */
    padding-top: 0; /* Fără padding sus */
}

    .order-total-compact span:first-child { /* Textul "Total" */
        display: block;
        font-size: 0.75rem; /* Mic */
        color: var(--brand-gray);
        font-weight: 500;
        margin-bottom: -3px; /* Apropie de preț */
    }

.total-amount { /* Prețul total */
    font-size: 1.15rem; /* Mărime proeminentă */
    font-weight: 700;
    color: var(--brand-red);
}
/* === SFÂRȘIT STILURI NOI === */

/* Footer Sticky */
.checkout-footer-sticky {
    padding: 10px 14px; /* Padding interior footer */
    border-top: 1px solid var(--brand-border);
    background-color: #ffffff;
    box-shadow: 0 -3px 10px rgba(0, 0, 0, 0.04);
    flex-shrink: 0; /* Nu se micșorează */
    margin-top: auto; /* Împinge în jos */
    position: absolute; /* Rămâne jos în containerul scrollabil */
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
}

/* Butonul de plasare comandă */
.place-order-btn {
    width: 100%;
    padding: 12px; /* Padding buton */
    background-color: var(--brand-red);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.95rem; /* Mărime text buton */
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px; /* Spațiu între text și spinner */
}

    .place-order-btn:hover {
        background-color: var(--brand-red-dark);
        transform: scale(1.01);
    }

    .place-order-btn:disabled {
        background-color: #d1d5db;
        color: #6b7280;
        cursor: not-allowed;
        opacity: 0.7;
        transform: none;
    }

/* Spinner */
.spinner {
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Stiluri confirmare comandă */
.confirmation-container {
    padding: 2rem 14px; /* Padding view confirmare */
    text-align: center;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.4s ease, transform 0.4s ease;
    font-family: 'Inter', sans-serif;
}

#cosLateral.confirmation-active .confirmation-container {
    opacity: 1;
    transform: scale(1);
}
/* Stil iconiță bifă */
.confirmation-icon {
    margin-bottom: 1rem;
}

    .confirmation-icon svg {
        width: 42px;
        height: 42px;
    }
/* Stil titlu H2 */
.confirmation-container h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    font-family: 'Teko', sans-serif;
    color: var(--brand-text);
}
/* Stil paragraf text */
.confirmation-container p {
    color: #374151;
    line-height: 1.5;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.confirmation-container strong#order-number {
    color: var(--brand-red);
    font-weight: 700;
}
/* Formular email confirmare */
#confirmation-email-form {
    margin: 1.5rem 0;
    padding: 1rem;
    background-color: var(--brand-light-gray);
    border-radius: 8px;
    border: 1px solid var(--brand-border);
}

    #confirmation-email-form p {
        font-size: 0.85rem;
        margin-bottom: 0.8rem;
        color: #4b5563;
        font-weight: 500;
    }

    #confirmation-email-form .form-group {
        display: flex;
        gap: 8px;
        margin-bottom: 0.5rem;
        align-items: stretch;
    }

    #confirmation-email-form input {
        flex-grow: 1;
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
        border: 1px solid var(--brand-border);
        border-radius: 5px;
    }

    #confirmation-email-form button {
        padding: 0.6rem 1rem;
        background-color: #4b5563;
        color: white;
        border: none;
        border-radius: 5px;
        font-weight: 600;
        cursor: pointer;
        transition: background-color 0.2s;
        font-size: 0.85rem;
    }

        #confirmation-email-form button:hover {
            background-color: #374151;
        }

        #confirmation-email-form button:disabled {
            background-color: #9ca3af;
            cursor: not-allowed;
        }

#confirmation-email-feedback {
    font-size: 0.8rem;
    margin-top: 0.5rem;
    min-height: 1.1em;
    font-weight: 500;
}

    #confirmation-email-feedback.success {
        color: var(--brand-success);
    }

    #confirmation-email-feedback.error {
        color: var(--brand-error);
    }
/* Sumar comandă confirmare */
.confirmation-summary {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #ddd;
    text-align: left;
    font-size: 0.9rem;
}

    .confirmation-summary h4 {
        font-size: 1rem;
        font-weight: 600;
        margin-bottom: 1rem;
        text-align: center;
        color: #374151;
    }

    .confirmation-summary div:not(.confirmation-total) {
        display: flex;
        justify-content: space-between;
        margin-bottom: 0.5rem;
        color: #4b5563;
    }

    .confirmation-summary span:last-child {
        font-weight: 600;
        color: var(--brand-text);
    }

.confirmation-total {
    margin-top: 1rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--brand-border);
    font-size: 1.1rem !important;
    color: var(--brand-text) !important;
    display: flex;
    justify-content: space-between;
    font-weight: 700;
}

    .confirmation-total strong {
        color: var(--brand-red) !important;
        font-weight: 700;
    }
/* Buton "Înapoi la magazin" */
.btn-back-to-shop {
    display: inline-block;
    margin-top: 2rem;
    padding: 0.8rem 1.5rem;
    background-color: #e5e7eb;
    color: #374151;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s ease;
    text-decoration: none;
    font-size: 0.9rem;
}

    .btn-back-to-shop:hover {
        background-color: #d1d5db;
        transform: scale(1.03);
    }

    .btn-back-to-shop:active {
        transform: scale(0.97);
    }


/* Optimizări mobile specifice pentru checkout */
@media (max-width: 375px) {
    #checkout-view, #confirmation-view {
        padding: 0 10px; /* Padding lateral mai mic */
    }

    .checkout-footer-sticky {
        padding: 8px 10px; /* Padding footer mai mic */
    }

    /* Reducem și mai mult padding-ul și fontul pe ecrane mici */
    .form-group input, .form-group textarea, .promo-inline input, .promo-input-group input { /* Adăugat .promo-input-group input */
        padding: 0.5rem 0.6rem 0.1rem 0.6rem; /* Și mai redus */
        font-size: 0.85rem;
        min-height: 36px; /* Și mai mic */
    }

    .form-group label {
        top: 0.3rem; /* <-- Ajustat și mai sus pentru mobil */
        font-size: 0.85rem;
    }
    /* Poziția etichetei sus rămâne la fel (-0.45rem) dar fontul e mai mic */
    .form-group input:focus + label,
    .form-group input:not(:placeholder-shown) + label,
    .form-group textarea:focus + label,
    .form-group textarea:not(:placeholder-shown) + label,
    .form-group.has-value label {
        font-size: 0.65rem; /* Eticheta sus și mai mică */
        top: -0.4rem; /* <-- Ajustat ușor mai jos pt font mic */
    }

    .person-type-selection {
        gap: 15px;
    }

    .person-type-option {
        font-size: 0.85rem;
    }

    .place-order-btn {
        font-size: 0.9rem;
        padding: 10px;
    }
    /* Ajustări pt secțiunea expandabilă pe mobil */
    .optional-details-toggle {
        font-size: 0.8rem;
    }

    .promo-input-group input {
        font-size: 0.8rem;
    }

    .btn-apply-promo {
        font-size: 0.75rem;
        height: 36px;
        line-height: 36px;
        padding: 0 0.8rem;
    }

    /* Ajustări pentru plată/livrare/total pe mobil */
    .payment-shipping-total-info {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .payment-shipping-compact {
        align-self: flex-start;
    }

    .order-total-compact {
        align-self: flex-end;
    }
}

/* Asigură că footer-ul sticky este vizibil doar în checkout */
#checkout-sticky-footer {
    display: none; /* Ascuns by default */
}

#cosLateral.checkout-active #checkout-sticky-footer {
    display: block; /* Afișat doar când #cosLateral are clasa .checkout-active */
    /* Folosim 'block' pt că footer-ul este un div simplu, nu flex */
}
