/* =============================================
   Sticky Product Panel
   ============================================= */

/* Header: icons + store row */
.sp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.sp-actions {
    display: flex;
    gap: 0.25rem;
}

:is(button).sp-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    transition: background .15s, color .15s;
    width: auto;
    height: auto;
    aspect-ratio: 1;
    min-height: auto;
}
:is(button).sp-action-btn:hover {
    background: #f5f5f5;
    color: #111;
}
.sp-action-btn svg {
    width: 1rem;
    height: 1rem;
    display: block;
    transition: opacity .15s;
}
.sp-action-btn.sp-action--loading {
    pointer-events: none;
}
.sp-action-btn.sp-action--loading svg {
    opacity: 0;
}
.sp-action-btn.sp-action--loading::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border: 2px solid #e0e0e0;
    border-top-color: #555;
    border-radius: 50%;
    animation: sp-rotate .8s linear infinite;
}
.sp-action-btn.sp-action--done svg {
    stroke: #039869;
}

.sp-store {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #555;
    direction: rtl;
}
.sp-store svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.sp-divider {
    border: none;
    border-top: 1px solid #eee;
    margin: 10px 0;
    width: 100%;
}

/* Warning text */
.sp-warning {
    font-size: 12px;
    color: #c0392b;
    display: flex;
    align-items: flex-start;
    gap: 6px;
    direction: rtl;
    margin-bottom: 10px;
    line-height: 1.5;
}
.sp-warning svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Add to cart button */
:is(button).sp-btn-cart {
    background: #039869;
    color: #fff;
    width: 100%;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 14px;
    font-weight: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    border: none;
    transition: background .15s, opacity .15s;
}
:is(button).sp-btn-cart:hover {
    background: #027a54;
    color: #fff;
}
.sp-btn-cart svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}
.sp-btn-cart--out-of-stock {
    background: #e74c3c;
    cursor: default;
    pointer-events: none;
}
.sp-btn-cart--in-cart {
    display: none !important;
}
.sp-btn-cart--loading {
    opacity: .65;
    pointer-events: none;
}
.sp-btn-cart--loading svg.sp-spin {
    animation: sp-rotate .8s linear infinite;
}

@keyframes sp-rotate {
    to { transform: rotate(360deg); }
}

/* Quantity control */
.sp-qty {
    display: none;
    align-items: center;
    gap: 0;
    margin-top: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    direction: ltr;
}
.sp-qty.is-visible {
    display: flex;
}
.sp-qty-btn {
    flex-shrink: 0;
    width: 36px;
    height: 38px;
    background: #f7f7f7;
    border: none;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    user-select: none;
}
.sp-qty-btn:hover {
    background: #ececec;
}
.sp-qty-btn:disabled {
    opacity: .4;
    cursor: default;
}
.sp-qty-input {
    flex: 1;
    min-width: 0;
    text-align: center;
    border: none;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    padding: 6px 4px;
    font-size: 14px;
    font-weight: 500;
    background: #fff;
    -moz-appearance: textfield;
    appearance: textfield;
    color: #111;
}
.sp-qty-input::-webkit-outer-spin-button,
.sp-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Remove from cart button (inside qty wrap) */
:is(button).sp-remove-btn {
    flex-shrink: 0;
    width: 36px;
    height: 38px;
    background: none;
    border: none;
    border-left: 1px solid #ddd;
    cursor: pointer;
    color: #c0392b;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
    padding: 0;
}
.sp-remove-btn:hover {
    background: #fff0f0;
    color: #e74c3c;
}
.sp-remove-btn svg {
    width: 14px;
    height: 14px;
    pointer-events: none;
}

/* Under-cart notice */
.sp-under-cart {
    font-size: 12px;
    color: #777;
    text-align: center;
    margin-top: 8px;
    direction: rtl;
}

/* Toast */
.sp-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #039869;
    color: #fff;
    padding: 10px 22px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    z-index: 99999;
    opacity: 0;
    transition: opacity .28s ease, transform .28s ease;
    pointer-events: none;
    white-space: nowrap;
    direction: rtl;
    box-shadow: 0 4px 16px rgba(3,152,105,.35);
}
.sp-toast.sp-toast--show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Mobile fixed bar */
.sp-mobile-bar {
    display: none;
}

@media (max-width: 991px) {
    /* Hide desktop sticky column */
    .box-info-inner-single-product {
        display: none !important;
    }

    /* Show mobile bar */
    .sp-mobile-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #fff;
        padding: 10px 14px;
        border-top: 1px solid rgba(0,0,0,.1);
        align-items: center;
        gap: 10px;
        z-index: 1000;
        direction: rtl;
    }
    .sp-mobile-bar .sp-btn-cart {
        flex: 1;
        padding: 11px 10px;
        font-size: 13px;
    }
    .sp-mobile-bar .sp-qty {
        margin-top: 0;
        flex-shrink: 0;
    }
    .sp-mobile-bar .sp-qty-btn {
        width: 34px;
        height: 36px;
    }
    .sp-mobile-bar .sp-qty-input {
        width: 42px;
        min-width: 42px;
    }
}
