/**
 * TwoPixels Sticky Add-to-Cart
 * CSS Styles with BEM naming convention
 */

/* Main container */
.tp-sticky {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background-color: var(--tp-sticky-bg, #ffffff);
    color: var(--tp-sticky-text, #333333);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    transform: translateY(-100%);
    transition: transform 0.3s ease-in-out;
}

.tp-sticky--visible {
    transform: translateY(0);
}

.tp-sticky--no-animation {
    transition: none;
}

/* Hidden until variant is selected (for variation articles) */
.tp-sticky--needs-variant.tp-sticky--no-variant-selected {
    display: none !important;
}

/* Inner wrapper */
.tp-sticky__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px 20px;
}

/* Product section */
.tp-sticky__product {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.tp-sticky__image {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 4px;
    background-color: #f5f5f5;
    flex-shrink: 0;
}

.tp-sticky__name {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Price section */
.tp-sticky__price {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.tp-sticky__price-old {
    font-size: 13px;
    text-decoration: line-through;
    color: #999;
}

.tp-sticky__price-current {
    font-size: 16px;
    font-weight: 700;
    color: inherit;
}

/* Actions section */
.tp-sticky__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* Quantity controls */
.tp-sticky__quantity {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.tp-sticky__qty-btn {
    width: 32px;
    height: 36px;
    border: none;
    background-color: #f5f5f5;
    color: var(--tp-sticky-text, #333333);
    font-size: 18px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tp-sticky__qty-btn:hover {
    background-color: #e5e5e5;
}

.tp-sticky__qty-btn:active {
    background-color: #d5d5d5;
}

.tp-sticky__qty-input {
    width: 45px;
    height: 36px;
    border: none;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    background-color: #fff;
    color: var(--tp-sticky-text, #333333);
    -moz-appearance: textfield;
}

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

/* Add to cart button */
.tp-sticky__btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    background-color: var(--tp-sticky-btn, #28a745);
    color: var(--tp-sticky-btn-text, #ffffff);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    white-space: nowrap;
}

.tp-sticky__btn:hover {
    filter: brightness(1.1);
}

.tp-sticky__btn:active {
    transform: scale(0.98);
}

.tp-sticky__btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.tp-sticky__btn-icon {
    flex-shrink: 0;
}

/* Loading state */
.tp-sticky__btn--loading {
    position: relative;
    color: transparent;
}

.tp-sticky__btn--loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid transparent;
    border-top-color: var(--tp-sticky-btn-text, #ffffff);
    border-radius: 50%;
    animation: tp-sticky-spin 0.8s linear infinite;
}

@keyframes tp-sticky-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Success state */
.tp-sticky__btn--success {
    background-color: #28a745 !important;
}

/* Go to cart button */
.tp-sticky__btn--goto {
    background-color: #17a2b8;
    text-decoration: none;
}

.tp-sticky__btn--goto:hover {
    background-color: #138496;
    color: var(--tp-sticky-btn-text, #ffffff);
}

/* Disabled state for variations */
.tp-sticky__btn--disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Variant hint */
.tp-sticky__hint {
    font-size: 12px;
    color: #dc3545;
    font-weight: 500;
    white-space: nowrap;
}

/* Responsive - Tablet */
@media (max-width: 991px) {
    .tp-sticky__name {
        max-width: 150px;
    }

    .tp-sticky__inner {
        padding: 8px 15px;
    }
}

/* Responsive - Mobile */
@media (max-width: 767px) {
    .tp-sticky__inner {
        padding: 8px 10px;
        gap: 10px;
    }

    /* Hide product name on mobile */
    .tp-sticky__name {
        display: none;
    }

    .tp-sticky__image {
        width: 40px;
        height: 40px;
    }

    .tp-sticky__price-old {
        display: none;
    }

    .tp-sticky__price-current {
        font-size: 14px;
    }

    .tp-sticky__quantity {
        display: none;
    }

    .tp-sticky__btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    .tp-sticky__btn-text {
        display: none;
    }

    .tp-sticky__btn-icon {
        width: 20px;
        height: 20px;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .tp-sticky__inner {
        gap: 8px;
    }

    .tp-sticky__price {
        flex: 1;
        justify-content: center;
    }
}
