/* =========================================================
   PRODUCT ADD TO CART SHORTCODE — Letisztult megjelenés
   ========================================================= */

.product-addtocart-wrapper {
    width: 100%;
    margin: 20px 0;
    font-family: "Plus Jakarta Sans", system-ui, sans-serif;
}

.product-addtocart-inner {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ----- Ár sor (fent) ----- */
.product-addtocart-price-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* ----- Mennyiség és Gomb sor (alatta) ----- */
.product-addtocart-action-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* ----- Sima ár érték ----- */
.product-addtocart-wrapper .product-addtocart-price-value {
    font-size: 32px;
    font-weight: 800;
    color: #26331f;
    line-height: 1;
}

/* =========================================================
   B2B ÁR KÁRTYA — Eredeti Lume B2B stílus megtartva
   (ugyanaz mint a termék kártyákon)
   ========================================================= */

.product-addtocart-wrapper .lume-b2b-price.lume-b2b-card {
    /* EREDETI STÍLUS - frontend.css */
    display: inline-flex;
    flex-direction: column;
    gap: 6px;
    background: linear-gradient(155deg, #f0f3e8 0%, #e6ebda 100%);
    border: 1px solid #c8d2b1;
    border-radius: 14px;
    padding: 10px 16px;
    max-width: 100%;
    line-height: 1.3;
    font-family: -apple-system, BlinkMacSystemFont, 'Plus Jakarta Sans', system-ui, sans-serif;
    color: #1c2418;
    /* Inline-flex a sorba illesztéshez */
    vertical-align: middle;
}

/* HEAD: label */
.product-addtocart-wrapper .lume-b2b-card__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.product-addtocart-wrapper .lume-b2b-card__label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #5a6c4f;
    line-height: 1;
}

/* PRICES */
.product-addtocart-wrapper .lume-b2b-card__prices {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}

.product-addtocart-wrapper .lume-b2b-card__price-now {
    font-size: 28px;
    font-weight: 800;
    color: #1c2418;
    text-decoration: none;
    line-height: 1.1;
}

.product-addtocart-wrapper .lume-b2b-card__price-now bdi,
.product-addtocart-wrapper .lume-b2b-card__price-now .woocommerce-Price-amount {
    color: inherit;
}

.product-addtocart-wrapper .lume-b2b-card__price-was {
    font-size: 16px;
    color: #a8a293;
    text-decoration: line-through;
    font-weight: 500;
}

.product-addtocart-wrapper .lume-b2b-card__price-was bdi,
.product-addtocart-wrapper .lume-b2b-card__price-was .woocommerce-Price-amount {
    color: inherit;
}

/* ----- Mennyiség választó ----- */
/* A wrapper prefix a specificitás növeléséhez — felülírja a téma/WC szabályokat. */
.product-addtocart-wrapper .product-addtocart-quantity {
    display: flex;
    align-items: center;
    gap: 0;
    background: #ffffff;
    border: 1.5px solid rgb(227, 221, 205);
    border-radius: 999px;
    overflow: hidden;
    flex-shrink: 0;
}

/* ----- Összesen sor ----- */
.product-addtocart-total-summary {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #718096;
    font-weight: 500;
    line-height: 1.4;
}

.total-quantity {
    color: #718096;
}

.total-separator {
    color: #cbd5e0;
}

.total-label {
    color: #718096;
}

.total-price {
    font-weight: 700;
    color: #2d3748;
}

.product-addtocart-wrapper .quantity-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 52px;
    background: transparent;
    color: rgb(58, 70, 48);
    border: none;
    font-family: "Plus Jakarta Sans", sans-serif;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.product-addtocart-wrapper .quantity-button:hover {
    background: #f5f6f2;
}

.product-addtocart-wrapper .quantity-button:active {
    background: #e8e9e5;
}

.product-addtocart-wrapper .quantity-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    color: #b0a99c;
}

.product-addtocart-wrapper .quantity-input {
    min-width: 34px;
    width: 50px;
    text-align: center;
    border: none;
    background: transparent;
    font-family: "Plus Jakarta Sans", sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: rgb(38, 51, 31);
    padding: 8px 4px;
    height: 52px;
    -moz-appearance: textfield;
}

.product-addtocart-wrapper .quantity-input::-webkit-outer-spin-button,
.product-addtocart-wrapper .quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.product-addtocart-wrapper .quantity-input:focus {
    outline: none;
}

.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ----- Kosárba gomb ----- */
.product-addtocart-button-wrapper {
    display: flex;
    flex-shrink: 0;
}

.product-addtocart-button {
    display: inline-flex !important;
    position: relative;
    align-items: center !important;
    justify-content: center !important;
    gap: 9px;
    min-width: 160px;
    white-space: nowrap;
    text-decoration: none !important;
    background: linear-gradient(135deg, rgb(217, 189, 134), rgb(193, 155, 95)) !important;
    color: rgb(58, 45, 5) !important;
    font-family: "Plus Jakarta Sans", sans-serif !important;
    font-size: 16px !important;
    font-weight: 800 !important;
    letter-spacing: 0.01em !important;
    padding: 0 28px !important;
    height: 52px;
    border: none !important;
    border-radius: 999px !important;
    box-shadow: rgba(150, 110, 30, 0.26) 0px 10px 22px !important;
    transition: filter 0.2s ease !important;
    cursor: pointer !important;
}

.product-addtocart-button svg {
    flex-shrink: 0;
}

.product-addtocart-button:hover {
    filter: brightness(1.05) !important;
    transform: translateY(-1px);
}

.product-addtocart-button:active {
    transform: translateY(0);
}

.product-addtocart-button.loading {
    opacity: 0.7;
    pointer-events: none;
}

.product-addtocart-button.loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 3px solid rgba(58, 45, 5, 0.3);
    border-top-color: #3a2d05;
    border-radius: 50%;
    animation: product-addtocart-spin 0.6s linear infinite;
    margin-left: 10px;
}

@keyframes product-addtocart-spin {
    to { transform: rotate(360deg); }
}

.product-addtocart-button.added {
    background: linear-gradient(135deg, #3a4a2e, #2b3a25) !important;
    color: #eef3e6 !important;
}

/* ----- Variable termék ----- */
.product-addtocart-wrapper.product-addtocart-variable {
    max-width: 500px;
}

.product-addtocart-notice {
    margin: 0 0 12px 0;
    padding: 12px 16px;
    background: #fff4e0;
    border-left: 3px solid #d98600;
    color: #5c3a00;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    border-radius: 8px;
}

.product-addtocart-view-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 24px;
    background: linear-gradient(135deg, #e2c878, #b8923c);
    color: #3a2d05;
    text-decoration: none;
    border-radius: 10px;
    font-family: "Plus Jakarta Sans", sans-serif;
    font-size: 15px;
    font-weight: 700;
    transition: filter 0.2s ease;
}

.product-addtocart-view-button:hover {
    filter: brightness(1.05);
}

/* ----- Hiba üzenet ----- */
.product-addtocart-error {
    padding: 12px 16px;
    background: #fee;
    border-left: 3px solid #c00;
    color: #600;
    font-size: 14px;
    border-radius: 8px;
    font-family: "Plus Jakarta Sans", sans-serif;
}

/* =========================================================
   Reszponzív
   ========================================================= */
@media (max-width: 768px) {
    .product-addtocart-action-row {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .product-addtocart-wrapper .product-addtocart-quantity {
        width: 100%;
        max-width: 100%;
    }

    .product-addtocart-button-wrapper {
        width: 100%;
    }

    .product-addtocart-button {
        width: 100% !important;
    }

    .product-addtocart-wrapper .product-addtocart-price-value {
        font-size: 28px;
    }

    .product-addtocart-wrapper .lume-b2b-card {
        padding: 12px 16px;
    }

    .product-addtocart-wrapper .lume-b2b-card__price-now {
        font-size: 26px;
    }

    .product-addtocart-wrapper .lume-b2b-card__price-was {
        font-size: 15px;
    }

    .product-addtocart-wrapper .quantity-button {
        width: 44px;
        height: 48px;
        font-size: 24px;
    }

    .product-addtocart-wrapper .quantity-input {
        width: 60px;
        height: 48px;
        font-size: 16px;
    }

    .product-addtocart-button {
        font-size: 14px !important;
        height: 48px;
    }

    .product-addtocart-total-summary {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .product-addtocart-wrapper {
        margin: 16px 0;
    }

    .product-addtocart-inner {
        gap: 10px;
    }

    .product-addtocart-wrapper .product-addtocart-price-value {
        font-size: 26px;
    }

    .product-addtocart-wrapper .lume-b2b-card__price-now {
        font-size: 24px;
    }

    .product-addtocart-wrapper .product-addtocart-quantity {
        max-width: 100%;
    }

    .product-addtocart-button {
        font-size: 14px !important;
    }
}

/* =========================================================
   Loading állapot
   ========================================================= */
.product-addtocart-wrapper.is-loading {
    opacity: 0.6;
    pointer-events: none;
}

.product-addtocart-wrapper.is-loading .product-addtocart-button::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 3px solid rgba(58, 45, 5, 0.3);
    border-top-color: #3a2d05;
    border-radius: 50%;
    animation: product-addtocart-spin 0.6s linear infinite;
    margin-left: 10px;
}

/* =========================================================
   Kosárba helyezés animáció
   ========================================================= */
@keyframes product-addtocart-success {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.product-addtocart-button.added {
    animation: product-addtocart-success 0.3s ease;
}

/* =========================================================
   STICKY BOTTOM BAR — görgetésre jelenik meg
   ========================================================= */
.product-addtocart-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999; /* menü (1000) felett, kosár-toast/cookie banner alatt */
    background: #ffffff;
    border-top: 1px solid rgb(227, 221, 205);
    box-shadow: 0 -8px 24px rgba(38, 51, 31, 0.10);
    font-family: "Plus Jakarta Sans", sans-serif;
    /* Alapból lefelé rejtve; az .is-hidden osztály tartja ott. */
    transform: translateY(0);
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 1;
}

/* Rejtett állapot (IntersectionObserver váltja) */
.product-addtocart-bar.is-hidden {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}

/* Belső container: középre igazított, max 1140px */
.product-addtocart-bar__inner {
    max-width: 1140px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Terméknév — középen, csonkítva, ha hosszú */
.product-addtocart-bar__name {
    flex: 1 1 0%;
    min-width: 0;
    font-size: 15px;
    font-weight: 700;
    color: rgb(38, 51, 31);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Ár */
.product-addtocart-bar__price {
    flex-shrink: 0;
}

.product-addtocart-bar__price .product-addtocart-price-value {
    font-size: 18px;
    line-height: 1;
}

/* Mennyiség + gomb csoport */
.product-addtocart-bar__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* A bar-on belüli gomb kompaktebb, mint a fő blokkban */
.product-addtocart-bar .product-addtocart-button {
    min-width: 140px;
    height: 44px;
    font-size: 14px !important;
    padding: 0 22px !important;
}

.product-addtocart-bar .product-addtocart-quantity {
    border-radius: 999px;
}

.product-addtocart-bar .quantity-button {
    width: 40px;
    height: 44px;
    font-size: 18px;
}

.product-addtocart-bar .quantity-input {
    height: 44px;
    font-size: 15px;
}

/* Body padding, amikor a bar látható — hogy a lábléc ne rejtsék el.
   A JS adja hozzá a 'has-atc-bar' osztályt. */
body.has-atc-bar {
    padding-bottom: 68px;
}

/* =========================================================
   STICKY BAR — Reszponzív (mobil)
   Mobilon a név rejtve, és a sorrend FORDÍTOTT: előbb a mennyiség +
   Kosárba gomb (az elérhető helyet kitölti), mellette az ár. Így a
   Kosárba gomb sosem csúszik le a képernyőről. Asztalon érintetlen.
   ========================================================= */
@media (max-width: 768px) {
    .product-addtocart-bar__inner {
        gap: 12px;
        padding: 10px 14px;
    }

    /* Név rejtve mobilon — a gomb + ár kapja a helyet. */
    .product-addtocart-bar__name {
        display: none;
    }

    /* Akciók (mennyiség + gomb) előre, balra; kitöltik a helyet. */
    .product-addtocart-bar__actions {
        order: 1;
        flex: 1 1 0%;
        min-width: 0;
    }

    /* Ár a gomb mellé (jobb oldal). */
    .product-addtocart-bar__price {
        order: 2;
        flex-shrink: 0;
    }

    .product-addtocart-bar__price .product-addtocart-price-value {
        font-size: 15px;
    }

    /* Mennyiség legfeljebb 43% — nem eszi meg a gomb és az ár helyét. */
    .product-addtocart-bar .product-addtocart-quantity {
        max-width: 43%;
    }

    /* Kompaktebb mennyiség-választó, hogy a gomb is kiférjen. */
    .product-addtocart-bar .quantity-button {
        width: 36px;
        height: 44px;
        font-size: 18px;
    }

    .product-addtocart-bar .quantity-input {
        width: 42px;
        height: 44px;
        font-size: 15px;
    }

    /* Gomb: rugalmas szélesség, így mindig látható. overflow:hidden biztosítja,
       hogy a gomb tartalma (ikon + szöveg) sosem csúszik át az árra. */
    .product-addtocart-bar .product-addtocart-button-wrapper {
        flex: 1 1 0%;
        min-width: 0;
    }

    .product-addtocart-bar .product-addtocart-button {
        flex: 1 1 0%;
        min-width: 0;
        padding: 0 16px !important;
        font-size: 14px !important;
        overflow: hidden;
    }

    body.has-atc-bar {
        padding-bottom: 60px;
    }

    /* A kosár-toast (mobilon bottom:12px, teljes szélesség) feljebb kerül,
       amikor a bar látható, hogy ne boruljon rá. */
    body.has-atc-bar .kv-cart-toast {
        bottom: 64px !important;
    }
}
