/**
 * 2026 Ecom Experts
 *
 *  @author    Ecom Experts <ecomyseo@gmail.com>
 *  @copyright 2026 Ecom Experts
 *  @license   http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */

#ecom-sticky-cart {
    position: fixed;
    z-index: 9999;
    left: 0;
    right: 0;
    --esc-gap-val: var(--esc-gap, 0px);
    /* Default 0 */
    background-color: var(--esc-bg);
    color: var(--esc-txt);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    padding: 10px 0;
    transition: transform 0.3s ease-in-out, opacity 0.3s;
    opacity: 0;
    pointer-events: none;
    transform: translateY(100%);
}

#ecom-sticky-cart.visible {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}

/* Position & Gap Logic */
#ecom-sticky-cart.position-bottom {
    bottom: var(--esc-gap-val);
}

#ecom-sticky-cart.position-top {
    top: var(--esc-gap-val);
    transform: translateY(-100%);
}

#ecom-sticky-cart.position-top.visible {
    transform: translateY(0);
}

/* --- Layout: Minimal (Floating) --- */
#ecom-sticky-cart.minimal {
    max-width: 1200px;
    margin: 0 auto;
    left: 20px;
    right: 20px;
    border-radius: 12px;
    bottom: calc(20px + var(--esc-gap-val));
    /* Add minimal spacing + user gap */
}

#ecom-sticky-cart.minimal.position-top {
    top: calc(20px + var(--esc-gap-val));
}

/* --- Layout: Modern (Glassmorphism) --- */
#ecom-sticky-cart.modern {
    background-color: rgba(255, 255, 255, 0.85) !important;
    /* Override user color partially or blend it */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.3);
}

/* Container & Grid */
#ecom-sticky-cart .sticky-container {
    max-width: 1600px;
    /* Increased from 1200px */
    margin: 0 auto;
    padding: 0 15px;
}

/* Product Info */
.ecom-sticky-cart .sticky-img {
    height: 50px;
    width: auto;
    border-radius: 4px;
    margin-right: 10px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.ecom-sticky-cart .product-info {
    display: flex;
    align-items: center;
}

.ecom-sticky-cart .product-name {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: #000000;
    /* User request */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.ecom-sticky-cart .product-price {
    display: block;
    font-weight: bold;
    color: var(--esc-btn);
    font-size: 15px;
}

/* Attributes Accordion */
.sticky-attributes {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    /* Allow wrapping on small screens */
}

.sticky-attribute-group {
    position: relative;
    min-width: 120px;
}

.sticky-accordion-header {
    background: rgb(87 87 87 / 47%);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    white-space: nowrap;
}

.sticky-accordion-header:hover {
    background: rgba(0, 0, 0, 0.06);
}

.sticky-accordion-content {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 0;
    min-width: 100%;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.1);
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 5px;
    z-index: 100;
}

/* Top position specific */
#ecom-sticky-cart.position-top .sticky-accordion-content {
    bottom: auto;
    top: 100%;
    margin-top: 5px;
    margin-bottom: 0;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.sticky-accordion-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sticky-attribute-option {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
    transition: background 0.2s;
    white-space: nowrap;
}

.sticky-attribute-option:hover {
    background: rgba(0, 0, 0, 0.05);
}

.sticky-attribute-option.selected {
    background: var(--esc-btn);
    color: var(--esc-btn-txt);
    font-weight: bold;
}

/* Active State for attributes */
.sticky-attribute-group.active .sticky-accordion-content {
    display: block;
}

/* Action Wrapper */
.ecom-sticky-cart .action-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

/* Quantity Selector - Classic Style */
.sticky-qty {
    margin-right: 1rem;
}

.sticky-qty .esc-touchspin {
    display: inline-flex;
    align-items: center;
    position: relative;
    width: 5.5rem;
    /* Compact width */
    background: #fff;
    border: 1px solid #e5e5e5;
    height: 2.75rem;
    /* ~44px, standard button height */
    padding: 0;
    box-shadow: 2px 2px 4px 0 rgba(0, 0, 0, .1);
    /* Slight shadow like classic */
}

/* Override form-control styles that themes might force */
.sticky-qty .esc-touchspin input.sticky-qty-input {
    width: 3.5rem !important;
    border: none !important;
    background: transparent !important;
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    color: #232323;
    padding: 0.2rem;
    height: 100%;
    -moz-appearance: textfield;
    appearance: none;
    box-shadow: none !important;
    outline: none !important;
}

.sticky-qty .input-group-btn-vertical {
    display: flex;
    flex-direction: column;
    width: 2rem;
    height: 100%;
    border-left: 1px solid #e5e5e5;
}

.sticky-qty .input-group-btn-vertical .btn-touchspin {
    flex: 1;
    padding: 0;
    margin: 0;
    background: #fff;
    border: none;
    border-radius: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #232323;
    transition: background 0.2s;
}

.sticky-qty .input-group-btn-vertical .btn-touchspin:hover {
    background: #2fb5d2;
    /* Primary color hover */
    color: #fff;
}

.sticky-qty .input-group-btn-vertical .btn-touchspin:first-child {
    border-bottom: 1px solid #e5e5e5;
}

.sticky-qty .input-group-btn-vertical i {
    font-size: 14px;
    line-height: 1;
}

/* Remove browser defaults */
.sticky-qty-input::-webkit-outer-spin-button,
.sticky-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Button */
.add-to-cart-sticky {
    background-color: var(--esc-btn) !important;
    color: var(--esc-btn-txt) !important;
    border: none;
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 14px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.add-to-cart-sticky:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

/* --- Layout: FAB (Floating Icon) --- */
#ecom-sticky-cart.fab {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    left: auto;
    right: 20px;
    bottom: calc(20px + var(--esc-gap-val)) !important;
    /* Respect gap */
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    overflow: visible;
    /* Allow popup to show outside */
    background-color: var(--esc-btn);
    /* Use button color as main FAB color */
    color: var(--esc-btn-txt);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

#ecom-sticky-cart.fab .fab-trigger {
    display: flex;
    width: 100%;
    height: 100%;
    justify-content: center;
    align-items: center;
}

#ecom-sticky-cart.fab .sticky-container {
    display: none;
    /* Initially hidden */
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 400px;
    /* Increased from 320px */
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
    padding: 15px;
    flex-direction: column;
    cursor: default;
    opacity: 0;
    transform: scale(0.9);
    transform-origin: bottom right;
    transition: all 0.2s ease;
}

/* FAB Expanded State (Popup) */
#ecom-sticky-cart.fab.expanded {
    border-radius: 50%;
    /* Keep FAB circle */
    transform: translateY(0) scale(1.05);
    /* Pulse effect */
}

#ecom-sticky-cart.fab.expanded .sticky-container {
    display: flex;
    opacity: 1;
    transform: scale(1);
}

/* Repurpose grid for FAB popup card */
#ecom-sticky-cart.fab .row {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    margin: 0;
}

#ecom-sticky-cart.fab .col-md-3,
#ecom-sticky-cart.fab .col-md-6,
#ecom-sticky-cart.fab .col-xs-4 {
    width: 100%;
    max-width: 100%;
    padding: 0;
}

/* Responsive Mobile Rules */
@media (max-width: 768px) {
    /* .ecom-sticky-cart .sticky-img { display: none; } Handled by TPL class */

    .ecom-sticky-cart .product-name {
        display: block;
        font-size: 11px;
        max-width: none;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        line-height: 1.2;
    }

    .ecom-sticky-cart .product-price {
        font-size: 13px;
    }

    /* Force attribute name display on mobile */
    .ecom-sticky-cart .group-name {
        display: inline-block !important;
        font-weight: 600;
        margin-right: 4px;
    }

    /* Show attributes but compact */
    .sticky-attributes {
        gap: 5px;
    }

    .sticky-attribute-group {
        min-width: 80px;
        flex: 1;
    }

    /* Layout stacking */
    .sticky-container .row {
        flex-wrap: nowrap;
        /* Force single line if possible */
    }

    .attributes-wrapper {
        flex-grow: 1;
        width: auto;
    }

    .action-wrapper {
        width: auto;
        padding-left: 5px;
    }

    .add-to-cart-sticky span {
        display: none;
        /* Hide text, show icon only */
    }

    .add-to-cart-sticky {
        padding: 8px 12px;
    }

    .add-to-cart-sticky .shopping-cart {
        margin: 0;
        font-size: 20px;
    }

    /* FAB Mobile Override */
    #ecom-sticky-cart.fab .sticky-container {
        position: fixed;
        bottom: 85px;
        left: auto;
        right: 9px;
        width: auto;
    }
}