/* ============================================================
   STICKY ADD TO CART BAR
   Plik: css/sticky-add-to-cart.css
   ============================================================ */

/* ── Kontener główny ── */
#sticky-atc-bar {
    position: fixed;
    bottom: -100px;           /* startuje poza ekranem */
    left: 0;
    right: 0;
    z-index: 9999;
    background: #fff;
    border-top: 2px solid #e8e8e8;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12);
    transition: bottom 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: bottom;
}
@media (max-width: 767px) {
    #sticky-atc-bar {
        bottom: -200px; /* ukryty stan na mobile */
    }

    #sticky-atc-bar.is-visible {
        bottom: 10%;
    }
}

/* Stan widoczny – dodawany przez JS */
#sticky-atc-bar.is-visible {
    bottom: 0;
}

/* ── Wewnętrzny wrapper ── */
.sticky-atc-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    min-height: 72px;
}

/* ── Sekcja produktu (lewa) ── */
.sticky-atc-product {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 0;            /* pozwala truncate tekstu */
}

/* ── Miniatura ── */
.sticky-atc-thumb {
    flex-shrink: 0;
    display: block;
    width: 60px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #ebebeb;
    transition: opacity 0.2s ease;
}

.sticky-atc-thumb:hover {
    opacity: 0.85;
}

.sticky-atc-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ── Info: nazwa + cena ── */
.sticky-atc-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.sticky-atc-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 320px;
    line-height: 1.3;
}

.sticky-atc-price {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.2;
}

.sticky-atc-price .amount {
    color: #222;
    font-weight: 700;
}

.sticky-atc-price ins {
    text-decoration: none;
}

.sticky-atc-price del {
    color: #999;
    font-weight: 400;
    font-size: 0.82rem;
    margin-right: 4px;
}

/* ── Akcje: ilość + przycisk (prawa) ── */
.sticky-atc-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* ── Kontrolka ilości ── */
.sticky-atc-qty-wrap {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    height: 44px;
}

.sticky-qty-btn {
    background: #f5f5f5;
    border: none;
    width: 36px;
    height: 44px;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    color: #333;
    transition: background 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.sticky-qty-btn:hover {
    background: #e0e0e0;
    color: #000;
}

.sticky-qty-btn:active {
    background: #d0d0d0;
}

.sticky-qty-input {
    width: 46px;
    height: 44px;
    border: none;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a1a1a;
    outline: none;
    -moz-appearance: textfield;
    padding: 0;
}

.sticky-qty-input::-webkit-outer-spin-button,
.sticky-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ── Główny przycisk dodaj do koszyka ── */
.sticky-atc-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 28px;
    height: 46px;
    background: #222;
    color: #fff;
    border: none;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    overflow: hidden;
    min-width: 160px;
}

.sticky-atc-btn:hover {
    background: #444;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    color: #fff;
    text-decoration: none;
}

.sticky-atc-btn:active {
    transform: scale(0.97);
}

/* Stany przycisku */
.sticky-atc-btn-loading,
.sticky-atc-btn-added {
    display: none;
    position: absolute;
}

/* Loading spinner */
.sticky-atc-btn.is-loading .sticky-atc-btn-text {
    opacity: 0;
}

.sticky-atc-btn.is-loading .sticky-atc-btn-loading {
    display: block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: sticky-spin 0.6s linear infinite;
    position: static;
}

/* Stan "Dodano" */
.sticky-atc-btn.is-added {
    background: #2e7d32;
}

.sticky-atc-btn.is-added .sticky-atc-btn-text {
    opacity: 0;
}

.sticky-atc-btn.is-added .sticky-atc-btn-added {
    display: flex;
    position: static;
    font-size: 1rem;
}

/* Przycisk dla produktu zmiennego */
.sticky-atc-btn--variable {
    background: #BD9E5E;
}

.sticky-atc-btn--variable:hover {
    background: #b8945a;
    color: #fff;
}

/* Brak w magazynie */
.sticky-atc-out-of-stock {
    font-size: 0.88rem;
    color: #c62828;
    font-weight: 600;
    padding: 10px 16px;
    background: #ffebee;
    border-radius: 6px;
}

/* Animacja spinnera */
@keyframes sticky-spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   RESPONSIVE – TABLET (max-width: 991px)
   ============================================================ */
@media (max-width: 991px) {
    .sticky-atc-name {
        max-width: 200px;
        font-size: 0.88rem;
    }

    .sticky-atc-btn {
        min-width: 140px;
        padding: 0 20px;
        font-size: 0.85rem;
    }
}

/* ============================================================
   RESPONSIVE – MOBILE (max-width: 767px)
   ============================================================ */
@media (max-width: 767px) {
    .sticky-atc-inner {
        flex-wrap: wrap;
        gap: 10px;
        padding: 8px 0;
        min-height: auto;
    }

    /* Produkt zajmuje całą szerokość na mobile */
    .sticky-atc-product {
        flex: 1 1 100%;
        width: 100%;
    }

    .sticky-atc-thumb {
        width: 48px;
        height: 48px;
    }

    .sticky-atc-name {
        font-size: 0.85rem;
        max-width: none;
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .sticky-atc-price {
        font-size: 0.85rem;
    }

    /* Akcje: pełna szerokość */
    .sticky-atc-actions {
        flex: 1 1 100%;
        width: 100%;
        justify-content: stretch;
        gap: 8px;
    }

    .sticky-atc-qty-wrap {
        flex-shrink: 0;
    }

    .sticky-atc-btn {
        flex: 1;
        min-width: 0;
        font-size: 0.82rem;
        padding: 0 12px;
        height: 42px;
        letter-spacing: 0.3px;
    }

    .sticky-qty-btn {
        width: 32px;
        height: 42px;
    }

    .sticky-qty-input {
        width: 40px;
        height: 42px;
        font-size: 0.9rem;
    }
}

/* ============================================================
   RESPONSIVE – MAŁE MOBILE (max-width: 400px)
   ============================================================ */
@media (max-width: 400px) {
    #sticky-atc-bar .container-lg {
        padding-left: 12px;
        padding-right: 12px;
    }

    .sticky-atc-thumb {
        width: 40px;
        height: 40px;
    }

    .sticky-atc-btn {
        font-size: 0.78rem;
        height: 40px;
    }
}
@media (max-width: 767px) {
    #sticky-atc-bar {
        bottom: -200px; /* ukryty stan na mobile */
    }

    #sticky-atc-bar.is-visible {
        bottom: 5%;
    }
}
