/* TS Bundle Builder - Frontend */

.tsbb-description {
    margin: 1rem 0 1.25rem;
    color: #3d2f1f;
    font-size: 0.95rem;
    line-height: 1.55;
}

.tsbb-description p { margin: 0 0 0.6rem; }
.tsbb-description p:last-child { margin-bottom: 0; }

.tsbb-builder {
    margin: 1.5rem 0;
}

/* === Promo banner virš slot'ų === */
.tsbb-promo-banner {
    background: linear-gradient(135deg, #fef5e7 0%, #f9e4b8 100%);
    border: 1px solid #e0c896;
    border-radius: 8px;
    padding: 0.7rem 1rem;
    margin-bottom: 1rem;
    text-align: center;
    line-height: 1.4;
}

.tsbb-promo-banner strong {
    display: block;
    font-size: 1.05rem;
    color: #6b4a1e;
    letter-spacing: 0.02em;
}

.tsbb-promo-banner span {
    font-size: 0.85rem;
    color: #8a6b3e;
}

.tsbb-promo-banner em {
    font-style: italic;
    font-weight: 600;
    color: #2d6a4f;
}

/* === Kaip tai veikia (instrukcija) === */
.tsbb-how-it-works {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: #faf7f2;
    border-left: 3px solid #8a6b3e;
    border-radius: 4px;
}

.tsbb-how-title {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #6b5b43;
    margin-bottom: 0.4rem;
    letter-spacing: 0.01em;
}

.tsbb-how-steps {
    margin: 0;
    padding: 0 0 0 1.4rem;
    list-style: decimal;
    color: #3d2f1f;
    font-size: 0.88rem;
    line-height: 1.55;
}

.tsbb-how-steps li {
    margin: 0;
    padding: 0.1rem 0;
}

.tsbb-how-steps li::marker {
    color: #8a6b3e;
    font-weight: 600;
}

.tsbb-how-steps strong {
    color: #3d2f1f;
    font-weight: 600;
}

@media (max-width: 480px) {
    .tsbb-how-it-works { padding: 0.65rem 0.85rem; }
    .tsbb-how-steps { font-size: 0.82rem; }
    .tsbb-how-title { font-size: 0.8rem; }
}

/* === Slot grid - DESKTOP & MOBILE: visada 4 stulpeliai vienoje eilėje === */
.tsbb-slots-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

@media (max-width: 480px) {
    .tsbb-slots-grid {
        gap: 0.4rem;
    }
}

/* === Slot wrapper (apima ribbon + slot + kaina) === */
.tsbb-slot-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.tsbb-gift-ribbon {
    position: absolute;
    top: -6px;
    right: -4px;
    z-index: 2;
    background: #2d6a4f;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 3px 7px;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(45, 106, 79, 0.35);
    white-space: nowrap;
    transform: rotate(2deg);
    pointer-events: none;
}

@media (max-width: 480px) {
    .tsbb-gift-ribbon {
        font-size: 0.5rem;
        padding: 2px 5px;
        top: -5px;
        right: -3px;
    }
}

.tsbb-slot-wrap.is-gift .tsbb-slot-btn {
    border-color: #b7e4c7;
    background: #f1faee;
}

.tsbb-slot-wrap.is-gift .tsbb-slot-btn:hover {
    border-color: #2d6a4f;
    background: #e9f5e1;
}

/* === Savings block (rodomas tik kai visi 4 pasirinkti) === */
.tsbb-savings {
    margin: 1rem 0;
    background: #f7f4ed;
    border: 1px solid #e8e0cc;
    border-radius: 8px;
    padding: 0.85rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.tsbb-savings-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

/* Pradinė vertė - mažesnė, antrinė info, ne akcentas */
.tsbb-savings-row.tsbb-savings-original {
    font-size: 0.8rem;
    color: #999;
}

.tsbb-savings-row.tsbb-savings-original .tsbb-savings-value {
    color: #999;
}

.tsbb-savings-strike {
    text-decoration: line-through;
    color: #999;
}

/* Sutaupai - ŽALSVAS HIGHLIGHT (svarbiausias akcentas) */
.tsbb-savings-row.tsbb-savings-save {
    background: #e9f5e1;
    color: #2d6a4f;
    margin: 0.1rem -0.3rem;
    padding: 0.55rem 0.75rem;
    border-radius: 6px;
    font-weight: 700;
    font-size: 1rem;
}

.tsbb-savings-save-amount {
    font-size: 1.15rem;
}

/* Tavo rinkinio kaina - PARYŠKINTA, antras akcentas (kiek moka) */
.tsbb-savings-row.tsbb-savings-bundle {
    font-weight: 600;
    color: #3d2f1f;
    padding-top: 0.45rem;
    border-top: 1px dashed #d4cfc4;
    font-size: 1rem;
}

.tsbb-savings-row.tsbb-savings-bundle .tsbb-savings-value {
    font-size: 1.2rem;
    color: #3d2f1f;
}

/* FOMO - mikrotekstas po viskuo, su švelnia animacija */
.tsbb-fomo {
    margin: 0.5rem 0 0;
    padding: 0;
    text-align: center;
    font-size: 0.78rem;
    color: #8a6b3e;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    opacity: 0;
    animation: tsbb-fomo-appear 0.5s ease-out 0.3s forwards;
}

.tsbb-fomo strong {
    font-weight: 700;
    color: #a85a35;
}

.tsbb-fomo-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #c44536;
    animation: tsbb-fomo-pulse 1.8s ease-in-out infinite;
}

@keyframes tsbb-fomo-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

@keyframes tsbb-fomo-appear {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 480px) {
    .tsbb-savings { padding: 0.7rem 0.85rem; }
    .tsbb-savings-row.tsbb-savings-original { font-size: 0.75rem; }
    .tsbb-savings-row.tsbb-savings-save { font-size: 0.92rem; }
    .tsbb-savings-save-amount { font-size: 1.05rem; }
    .tsbb-savings-row.tsbb-savings-bundle { font-size: 0.92rem; }
    .tsbb-savings-row.tsbb-savings-bundle .tsbb-savings-value { font-size: 1.1rem; }
    .tsbb-fomo { font-size: 0.72rem; }
}

.tsbb-slot-btn {
    position: relative;
    aspect-ratio: 1 / 1;
    border: 2px dashed #d4cfc4;
    background: #faf7f2;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    transition: all 0.15s ease;
    overflow: hidden;
}

.tsbb-slot-btn:hover {
    border-color: #8a6b3e;
    background: #f5efe4;
}

.tsbb-slot-btn.is-filled {
    border-style: solid;
    border-color: #8a6b3e;
    background: #fff;
}

.tsbb-slot-placeholder {
    color: #a89c83;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tsbb-slot-selected {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    position: relative;
}

.tsbb-slot-img {
    max-width: 70%;
    max-height: 65%;
    object-fit: contain;
}

.tsbb-slot-name {
    font-size: 0.7rem;
    text-align: center;
    line-height: 1.1;
    color: #3d2f1f;
    padding: 0 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 480px) {
    .tsbb-slot-btn { padding: 0.3rem; }
    .tsbb-slot-name {
        font-size: 0.6rem;
        padding: 0 0.1rem;
        -webkit-line-clamp: 2;
    }
    .tsbb-slot-img { max-width: 80%; max-height: 60%; }
    .tsbb-slot-remove {
        width: 18px;
        height: 18px;
        font-size: 13px;
    }
}

.tsbb-slot-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #ddd;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tsbb-slot-remove:hover { background: #fff; color: #c33; }

/* === Slot labels (po grid'u) === */
.tsbb-slot-label {
    margin: 0.25rem 0;
    color: #6b5b43;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tsbb-slot-label::before {
    content: counter(slot-counter);
    counter-increment: slot-counter;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #f0e9da;
    color: #6b5b43;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.tsbb-builder { counter-reset: slot-counter; }

.tsbb-slot-label.is-filled { color: #2d6a4f; }
.tsbb-slot-label.is-filled::before { background: #d4edda; }

/* === Actions === */
.tsbb-actions {
    margin-top: 1.25rem;
}

.tsbb-add-to-cart:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.tsbb-validation {
    color: #c33;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* === Lightbox === */
.tsbb-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tsbb-lightbox[hidden] { display: none; }

.tsbb-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(30, 22, 12, 0.6);
    cursor: pointer;
}

.tsbb-lightbox-panel {
    position: relative;
    background: #fff;
    width: min(900px, 95vw);
    max-height: 85vh;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.tsbb-lightbox-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #eee5d4;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tsbb-lightbox-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 500;
    color: #3d2f1f;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tsbb-lightbox-close {
    background: none;
    border: none;
    font-size: 1.75rem;
    cursor: pointer;
    line-height: 1;
    color: #888;
    padding: 0 0.25rem;
}

.tsbb-lightbox-close:hover { color: #000; }

.tsbb-lightbox-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}

.tsbb-lightbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}

@media (max-width: 600px) {
    .tsbb-lightbox-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.6rem;
    }

    .tsbb-lightbox-panel {
        width: 100vw;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
    }

    .tsbb-lightbox-body {
        padding: 0.75rem;
    }

    .tsbb-product-card {
        padding: 0.5rem;
    }

    .tsbb-product-card-name {
        font-size: 0.75rem;
        min-height: 2.4em;
    }

    .tsbb-product-card-price {
        font-size: 0.75rem;
    }
}

.tsbb-lightbox-loader {
    text-align: center;
    color: #888;
    padding: 2rem;
}

.tsbb-product-card {
    border: 1px solid #eee5d4;
    border-radius: 8px;
    padding: 0.75rem;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s ease;
    background: #fff;
}

.tsbb-product-card:hover {
    border-color: #8a6b3e;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(138, 107, 62, 0.15);
}

.tsbb-product-card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    margin-bottom: 0.5rem;
}

.tsbb-product-card-name {
    font-size: 0.85rem;
    line-height: 1.3;
    color: #3d2f1f;
    margin: 0 0 0.25rem;
    min-height: 2.2em;
}

.tsbb-product-card-price {
    font-size: 0.85rem;
    color: #6b5b43;
}

/* === Cart line styling === */
.tsbb-included {
    color: #888;
    font-style: italic;
    font-size: 0.9em;
}

.tsbb-qty-locked {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: #f5f0e6;
    border-radius: 4px;
    color: #6b5b43;
    font-size: 0.9em;
}

/* Body scroll lock kai lightbox atidarytas */
body.tsbb-lightbox-open {
    overflow: hidden;
}
