/* Sticky Add to Cart Bar */
.sticky-add-to-cart-bar {
    position: fixed;
    bottom: -120px; /* Hidden by default */
    left: 0;
    right: 0;
    width: 100%;
    background: white;
    border-top: 2px solid #156b48;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
    z-index: 999999 !important; /* Force above Tidio chat */
    padding: 0;
    transition: bottom 0.3s ease-in-out;
    /* Fix for Chrome mobile positioning */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Force Tidio to stay below */
#tidio-chat,
#tidio-chat-root,
#tidio-chat iframe {
    z-index: 999998 !important;
}

/* Container with margin */
.sticky-bar-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 15px 0;
    max-width: 100%;
    margin: 0 auto;
}

/* Large desktop screens */
@media (min-width: 1400px) {
    .sticky-bar-container {
        max-width: 1170px;
        padding: 15px 15px;
    }
}

/* Medium desktop screens */
@media (min-width: 1200px) and (max-width: 1399px) {
    .sticky-bar-container {
        max-width: 1170px;
        padding: 15px 15px;
    }
}

/* Small desktop/tablet landscape */
@media (min-width: 992px) and (max-width: 1199px) {
    .sticky-bar-container {
        max-width: 970px;
        padding: 15px 15px;
    }
}

/* Tablet portrait */
@media (min-width: 769px) and (max-width: 991px) {
    .sticky-bar-container {
        max-width: 750px;
        padding: 15px 15px;
    }
}

/* Show when active */
.sticky-add-to-cart-bar.active {
    bottom: 0;
}

/* Product image */
.sticky-product-image {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    position: relative;
    overflow: visible;
}

.sticky-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

/* Grade badge */
.sticky-grade-badge {
    position: absolute;
    top: -5px;
    left: -5px;
    background: #156b48;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 4px;
    border-radius: 3px;
    line-height: 1;
}

/* Product info section */
.sticky-cart-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sticky-product-name {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 400px; /* Limit width to force truncation */
}

.sticky-product-price {
    font-size: 18px;
    font-weight: 700;
    color: #156b48;
    display: flex;
    align-items: baseline;
    gap: 0;
}

.sticky-product-price .current-price {
    color: #156b48;
    font-weight: 700;
}

.sticky-product-price s.old-price {
    font-size: 18px;
    color: #999;
    font-weight: 400;
    text-decoration: line-through;
}

.sticky-product-price .price-divider {
    display: none;
}

.sticky-product-meta {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: #666;
}

.sticky-stock-status {
    display: flex;
    align-items: center;
    gap: 5px;
}

.sticky-stock-status.in-stock {
    color: #156b48;
}

.sticky-stock-status.in-stock:before {
    content: '\f111';
    font-family: 'Font Awesome 5 Pro', 'Font Awesome 5 Free', 'FontAwesome';
    color: #b2ffac;
    margin-right: 5px;
    font-size: 12px;
    font-weight: 900;
    display: inline-block;
}

.sticky-shipping-info {
    color: #666;
}

.sticky-free-shipping {
    color: #156b48;
    font-weight: 600;
}

/* Add to cart button */
.sticky-add-to-cart-btn {
    background: #156b48;
    color: white;
    border: none;
    padding: 14px 35px;
    font-size: 17px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s ease;
    min-width: 180px;
    text-align: center;
}

.sticky-add-to-cart-btn:hover {
    background: #0f4d33;
}

.sticky-add-to-cart-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .sticky-add-to-cart-bar {
        bottom: -180px; /* Bigger bar on mobile for full width button */
    }

    .sticky-add-to-cart-bar.active {
        bottom: 0 !important;
        position: fixed !important;
        /* Ensure it sticks on Chrome mobile */
        transform: translate3d(0, 0, 0) !important;
        -webkit-transform: translate3d(0, 0, 0) !important;
    }

    /* Push Tidio chat up when sticky bar is active */
    .sticky-add-to-cart-bar.active ~ #tidio-chat-root,
    body:has(.sticky-add-to-cart-bar.active) #tidio-chat-root {
        bottom: 120px !important;
        transition: bottom 0.3s ease-in-out;
    }

    .sticky-bar-container {
        padding: 0;
        flex-wrap: wrap;
        max-width: 100%;
        gap: 0;
        align-items: flex-start;
        position: relative;
    }

    /* Top content row wrapper */
    .sticky-product-image {
        width: 50px;
        height: 50px;
        margin: 10px 0 0px 10px;
    }

    .sticky-cart-info {
        flex: 1;
        min-width: 0;
        gap: 2px;
        padding: 10px 10px 10px 5px;
    }

    .sticky-product-meta {
        display: none;
    }

    .sticky-add-to-cart-btn {
        width: calc(100% - 20px);
        padding: 15px;
        font-size: 1rem;
        min-width: calc(100% - 20px);
        border-radius: 4px;
        margin: 10px;
        display: block;
        text-align: center;
        border: none;
    }

    .sticky-product-name {
        font-size: 1rem;
        line-height: 100%;
        font-weight: 500;
        max-width: 100%;
    }

    .sticky-product-price {
        font-size: 1.5rem;
        line-height: 150%;
        margin-top: 3px;
        display: block;
    }

    .sticky-product-price .current-price {
        font-size: 1.5rem;
        font-weight: 700;
        color: #156b48;
    }

    /* Handle price with strikethrough */
    .sticky-product-price s.old-price {
        font-size: 1.5rem;
        color: #999;
        font-weight: 400;
        text-decoration: line-through;
    }

    .sticky-product-price .price-divider {
        display: inline-block;
        width: 6px;
    }
}

/* Very small screens */
@media (max-width: 400px) {
    .sticky-product-meta {
        font-size: 11px;
    }

    .sticky-product-price {
        font-size: 14px;
    }
}