/**
 * UruShop Sticky Add-to-Cart Bar Styles
 *
 * @see mu-plugins/specs/urushop-sticky-cart.spec.md
 */

/* ==========================================================================
   Main Container
   ========================================================================== */

.urushop-sticky-cart {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #fff;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
    opacity: 0;
    visibility: hidden;
}

.urushop-sticky-cart--visible {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .urushop-sticky-cart {
        transition: opacity 0.1s ease;
        transform: translateY(0);
    }

    .urushop-sticky-cart:not(.urushop-sticky-cart--visible) {
        opacity: 0;
        visibility: hidden;
    }
}

/* ==========================================================================
   Container Layout
   ========================================================================== */

.urushop-sticky-cart__container {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    height: 70px;
}

/* ==========================================================================
   Product Image
   ========================================================================== */

.urushop-sticky-cart__image {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
}

.urushop-sticky-cart__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

/* ==========================================================================
   Product Info (Name + Price)
   ========================================================================== */

.urushop-sticky-cart__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.urushop-sticky-cart__name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #1B4332;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

.urushop-sticky-cart__price {
    font-size: 0.875rem;
    font-weight: 700;
    color: #00A86B;
}

.urushop-sticky-cart__price del {
    color: #999;
    font-weight: 400;
    margin-right: 0.5rem;
}

.urushop-sticky-cart__price ins {
    text-decoration: none;
}

/* ==========================================================================
   Stock Status
   ========================================================================== */

.urushop-sticky-cart__stock {
    flex-shrink: 0;
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
}

.urushop-sticky-cart__stock--instock {
    color: #00A86B;
    background: rgba(0, 168, 107, 0.1);
}

.urushop-sticky-cart__stock--low {
    color: #F59E0B;
    background: rgba(245, 158, 11, 0.1);
}

.urushop-sticky-cart__stock--backorder {
    color: #6B7280;
    background: rgba(107, 114, 128, 0.1);
}

/* ==========================================================================
   Quantity Selector
   ========================================================================== */

.urushop-sticky-cart__quantity {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
}

.urushop-sticky-cart__qty-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: #f5f5f5;
    color: #333;
    font-size: 1.125rem;
    cursor: pointer;
    transition: background 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.urushop-sticky-cart__qty-btn:hover {
    background: #e8e8e8;
}

.urushop-sticky-cart__qty-btn:active {
    background: #ddd;
}

.urushop-sticky-cart__qty-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.urushop-sticky-cart__qty-input {
    width: 50px;
    height: 36px;
    border: none;
    border-left: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;
    text-align: center;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #333;
    -moz-appearance: textfield;
}

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

.urushop-sticky-cart__qty-input:focus {
    outline: none;
    background: #f9f9f9;
}

/* ==========================================================================
   Add to Cart Button
   ========================================================================== */

.urushop-sticky-cart__button {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 150px;
    height: 44px;
    padding: 0 1.5rem;
    border: none;
    border-radius: 6px;
    background: #00A86B;
    color: #fff;
    font-size: 0.9375rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    -webkit-appearance: none;
    appearance: none;
}

.urushop-sticky-cart__button:hover {
    background: #008f5a;
}

.urushop-sticky-cart__button:active {
    transform: scale(0.98);
}

.urushop-sticky-cart__button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* ==========================================================================
   Mobile Responsive (< 768px)
   ========================================================================== */

@media (max-width: 767px) {
    .urushop-sticky-cart__container {
        flex-wrap: wrap;
        height: auto;
        padding: 0.75rem 1rem;
        gap: 0.75rem;
    }

    /* Row 1: Image, Name, Quantity */
    .urushop-sticky-cart__image {
        width: 40px;
        height: 40px;
    }

    .urushop-sticky-cart__info {
        flex: 1;
        order: 1;
    }

    .urushop-sticky-cart__name {
        font-size: 0.875rem;
        max-width: 150px;
    }

    .urushop-sticky-cart__price {
        display: none; /* Hide in info, show above button */
    }

    /* Hide stock on mobile */
    .urushop-sticky-cart__stock {
        display: none;
    }

    .urushop-sticky-cart__quantity {
        order: 2;
    }

    .urushop-sticky-cart__qty-btn {
        width: 32px;
        height: 32px;
    }

    .urushop-sticky-cart__qty-input {
        width: 40px;
        height: 32px;
        font-size: 0.875rem;
    }

    /* Row 2: Price + Button (full width) */
    .urushop-sticky-cart__button {
        order: 3;
        flex: 1;
        width: 100%;
        min-width: unset;
        height: 44px;
    }

    /* Show price on button row for mobile */
    .urushop-sticky-cart__container::after {
        content: attr(data-price);
        order: 3;
        font-size: 0.9375rem;
        font-weight: 700;
        color: #00A86B;
    }
}

/* ==========================================================================
   Tablet (768px - 1024px)
   ========================================================================== */

@media (min-width: 768px) and (max-width: 1024px) {
    .urushop-sticky-cart__container {
        padding: 0.75rem 1rem;
    }

    .urushop-sticky-cart__name {
        max-width: 200px;
    }
}
