/**
 * Sticky Cart Styling - Afriyah
 * Refined for consistency, performance, and responsiveness
 */

/* Sticky cart - ALWAYS visible on product pages */
.af-sticky-cart {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    min-height: 80px !important;
    background: #fff !important;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12) !important;
    z-index: 9990 !important;
    padding: 12px 20px !important;
    border-top: 1px solid #eee !important;
    box-sizing: border-box !important;
    display: flex !important;
}

.af-sticky-cart.visible {
    bottom: 0 !important;
    display: flex !important;
    visibility: visible !important;
}

.af-sticky-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    gap: 24px;
    flex-wrap: nowrap;
    overflow: hidden;
}

.af-sticky-product {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    max-width: 100%;
}

.af-sticky-img {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    min-width: 56px;
    min-height: 56px;
    aspect-ratio: 1 / 1;
    background: #f7f7f7;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #eee;
}

.af-sticky-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.af-sticky-info {
    min-width: 0;
    max-width: 100%;
}

.af-sticky-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    display: block;
    max-width: 100%;
}

.af-sticky-price {
    display: block;
    font-size: 16px;
    color: #fe4322;
    font-weight: 800;
    margin-top: 4px;
}

.af-sticky-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px 10px;
    align-items: center;
    justify-content: flex-end;
    flex: 0 0 auto;
    max-width: 55%;
    min-width: 220px;
}

/* Keep product title visible after variable CTA state changes. */
#af-sticky-cart .af-sticky-product {
    flex: 1 1 calc(100% - 360px) !important;
    min-width: 180px !important;
}

#af-sticky-cart .af-sticky-actions {
    flex: 0 0 auto !important;
    margin-left: auto;
}

/* Base Button Styling */
.af-sticky-btn {
    min-height: 50px;
    height: auto;
    padding: 0 22px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    white-space: nowrap;
}

.af-sticky-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.af-sticky-btn i {
    font-size: 16px;
}

/* Specific Button Colors */
.af-sticky-add-to-cart {
    background: #fe4322;
    color: #fff;
}

.af-sticky-add-to-cart:hover {
    background: #004d00;
}

.af-sticky-buy-now {
    background: linear-gradient(135deg, #ffd84d 0%, #f4be00 100%);
    color: #1a1a1a;
    border: 1px solid #e2ad00;
    box-shadow: 0 6px 14px rgba(244, 190, 0, 0.28);
}

.af-sticky-buy-now:hover {
    background: linear-gradient(135deg, #ffe277 0%, #ffd028 100%);
}

.af-sticky-paypal {
    background: #0070ba;
    color: #fff;
}

.af-sticky-applepay {
    background: #000;
    color: #fff;
}

.af-sticky-cta-dynamic[data-state="select-options"] {
    background: #1a1a1a;
    color: #fff;
}

/* Mobile Responsiveness */
@media (max-width: 991px) {
    .af-sticky-cart {
        padding: 12px 16px;
        min-height: 72px;
    }
}

@media (max-width: 768px) {
    .af-sticky-cart {
        bottom: 0;
        min-height: 58px !important;
        padding: 6px 10px calc(env(safe-area-inset-bottom, 0px) + 6px) !important;
        z-index: 100020 !important;
    }

    .af-sticky-img {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
    }

    .af-sticky-price {
        display: none;
    }

    .af-sticky-container {
        gap: 8px !important;
        flex-wrap: nowrap !important;
        overflow: hidden !important;
        align-items: center !important;
    }

    .af-sticky-actions {
        flex: 0 0 auto !important;
        justify-content: flex-end !important;
        max-width: none !important;
        min-width: 0 !important;
        flex-wrap: nowrap !important;
        gap: 6px !important;
    }

    #af-sticky-cart .af-sticky-product {
        flex: 1 1 auto !important;
        min-width: 0 !important;
    }

    .af-sticky-btn {
        padding: 0 10px !important;
        min-height: 36px !important;
        height: 36px !important;
        font-size: 12px !important;
        flex: 0 0 auto !important;
        border-radius: 30px !important;
    }
}

@media (max-width: 480px) {
    .af-sticky-title {
        font-size: 13px;
        max-width: 120px;
    }

    .af-sticky-btn span {
        display: none;
    }

    .af-sticky-btn {
        padding: 0 12px;
        min-width: 44px;
    }

    .af-sticky-btn i {
        margin: 0;
    }
}
