/**
 * StoreWe — ux.css
 * Premium UX layer: skeletons · product card overlays · micro-animations
 * sticky mobile CTA · checkout steps · filter chips · grid/list toggle
 */

/* ═══════════════════════════════════════════════════════════════════════════
   1. SKELETON LOADERS
   ═══════════════════════════════════════════════════════════════════════════ */

@keyframes skeletonPulse {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: linear-gradient(90deg,
            var(--sw-bg-secondary, #f0f2f5) 25%,
            var(--sw-bg-hover, #e4e6ea) 50%,
            var(--sw-bg-secondary, #f0f2f5) 75%);
    background-size: 200% 100%;
    animation: skeletonPulse 1.5s ease-in-out infinite;
    border-radius: .5rem;
}

.skeleton-card {
    border-radius: 1rem;
    overflow: hidden;
    background: var(--sw-bg-primary, #fff);
    box-shadow: 0 1px 8px rgba(0, 0, 0, .06);
}

.skeleton-img {
    width: 100%;
    height: 220px;
}

.skeleton-text {
    height: .85rem;
    margin: .5rem .75rem;
}

.skeleton-text.sm {
    width: 60%;
}

.skeleton-text.lg {
    width: 80%;
}

.skeleton-btn {
    height: 2.2rem;
    margin: .75rem;
    border-radius: .5rem;
}

/* Dark mode skeletons */
[data-theme=dark] .skeleton {
    background: linear-gradient(90deg, #2d3448 25%, #343d56 50%, #2d3448 75%);
    background-size: 200% 100%;
    animation: skeletonPulse 1.5s ease-in-out infinite;
}


/* ═══════════════════════════════════════════════════════════════════════════
   2. PRODUCT CARD — HOVER OVERLAY (Quick-view + Wishlist)
   ═══════════════════════════════════════════════════════════════════════════ */

.product-card {
    position: relative;
    transition: transform .22s ease, box-shadow .22s ease;
    border-radius: 1rem !important;
    overflow: hidden;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, .14) !important;
}

.product-card .card-img-overlay-ux {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: .6rem;
    pointer-events: none;
    transition: background .22s ease;
}

.product-card:hover .card-img-overlay-ux {
    background: rgba(0, 0, 0, .08);
}

/* Wishlist heart */
.btn-wishlist {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, .92);
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .18s, color .18s, transform .18s;
    pointer-events: all;
    opacity: 0;
    transform: scale(.8);
}

.product-card:hover .btn-wishlist {
    opacity: 1;
    transform: scale(1);
}

.btn-wishlist.active,
.btn-wishlist:hover {
    color: #ef4444;
    background: #fff;
    transform: scale(1.12);
}

.btn-wishlist.active {
    color: #ef4444;
}

/* Quick-view pill */
.btn-quick-view {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(79, 70, 229, .92);
    color: #fff;
    border: none;
    padding: .55rem;
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .04em;
    cursor: pointer;
    transform: translateY(100%);
    transition: transform .22s ease;
    pointer-events: all;
}

.product-card .position-relative:hover .btn-quick-view {
    transform: translateY(0);
}

/* Image zoom on hover */
.product-card .card-img-top {
    transition: transform .35s ease;
}

.product-card:hover .card-img-top {
    transform: scale(1.04);
}


/* ═══════════════════════════════════════════════════════════════════════════
   3. ADD-TO-CART MICRO-ANIMATION
   ═══════════════════════════════════════════════════════════════════════════ */

@keyframes cartBounce {
    0% {
        transform: scale(1);
    }

    40% {
        transform: scale(1.35);
    }

    70% {
        transform: scale(.9);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes rippleOut {
    from {
        box-shadow: 0 0 0 0 rgba(79, 70, 229, .45);
    }

    to {
        box-shadow: 0 0 0 14px rgba(79, 70, 229, 0);
    }
}

@keyframes checkmark {
    from {
        opacity: 0;
        transform: scale(.5) rotate(-15deg);
    }

    to {
        opacity: 1;
        transform: scale(1) rotate(0);
    }
}

.btn-atc-loading {
    pointer-events: none;
    opacity: .75;
}

.btn-atc-success {
    background: #10b981 !important;
    border-color: #10b981 !important;
    animation: rippleOut .5s ease forwards;
}

.btn-atc-success i {
    animation: checkmark .3s ease forwards;
}

/* Cart count badge bounce */
.cart-badge-bounce {
    animation: cartBounce .4s cubic-bezier(.36, .07, .19, .97);
}


/* ═══════════════════════════════════════════════════════════════════════════
   4. ACTIVE FILTER CHIPS
   ═══════════════════════════════════════════════════════════════════════════ */

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-bottom: 1rem;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .28rem .7rem;
    border-radius: 99px;
    background: var(--sw-accent, #4f46e5);
    color: #fff;
    font-size: .78rem;
    font-weight: 500;
    white-space: nowrap;
    animation: fadeInUp .2s ease;
}

.filter-chip .chip-remove {
    background: none;
    border: none;
    color: rgba(255, 255, 255, .75);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    font-size: 1rem;
    transition: color .15s;
}

.filter-chip .chip-remove:hover {
    color: #fff;
}


/* ═══════════════════════════════════════════════════════════════════════════
   5. GRID / LIST TOGGLE
   ═══════════════════════════════════════════════════════════════════════════ */

.view-toggle .btn {
    transition: background .18s, color .18s;
}

.view-toggle .btn.active {
    background: var(--sw-accent, #4f46e5);
    color: #fff;
    border-color: var(--sw-accent, #4f46e5);
}

/* List layout overrides */
#productGrid.list-mode .col-md-6,
#productGrid.list-mode .col-lg-4 {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100%;
}

#productGrid.list-mode .product-card {
    flex-direction: row !important;
    display: flex !important;
}

#productGrid.list-mode .product-card .card-img-top {
    width: 160px;
    min-width: 160px;
    height: 160px !important;
    object-fit: cover;
    border-radius: 1rem 0 0 1rem;
}

#productGrid.list-mode .product-card .card-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
}


/* ═══════════════════════════════════════════════════════════════════════════
   6. INSTANT SEARCH SUGGESTIONS DROPDOWN
   ═══════════════════════════════════════════════════════════════════════════ */

.search-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--sw-bg-primary, #fff);
    border: 1px solid var(--sw-border, #e2e8f0);
    border-radius: .75rem;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .12);
    z-index: 1050;
    overflow: hidden;
    animation: fadeInUp .15s ease;
}

.search-suggestion-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem 1rem;
    cursor: pointer;
    transition: background .15s;
    font-size: .9rem;
    text-decoration: none;
    color: inherit;
}

.search-suggestion-item:hover,
.search-suggestion-item.focused {
    background: var(--sw-hover-bg, #f1f5f9);
}

.search-suggestion-item img {
    width: 38px;
    height: 38px;
    object-fit: cover;
    border-radius: .4rem;
    flex-shrink: 0;
}

.search-suggestion-item .suggestion-name {
    font-weight: 500;
}

.search-suggestion-item .suggestion-price {
    font-size: .8rem;
    color: var(--sw-accent, #4f46e5);
    font-weight: 600;
}


/* ═══════════════════════════════════════════════════════════════════════════
   7. STICKY MOBILE ADD-TO-CART BAR
   ═══════════════════════════════════════════════════════════════════════════ */

.sticky-atc-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1040;
    background: var(--sw-bg-primary, #fff);
    border-top: 1px solid var(--sw-border, #e2e8f0);
    padding: .75rem 1rem;
    display: flex;
    align-items: center;
    gap: .75rem;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, .1);
    transform: translateY(100%);
    transition: transform .3s cubic-bezier(.4, 0, .2, 1);
}

.sticky-atc-bar.visible {
    transform: translateY(0);
}

.sticky-atc-bar .sticky-product-name {
    font-weight: 600;
    font-size: .9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.sticky-atc-bar .sticky-price {
    font-weight: 700;
    color: var(--sw-accent, #4f46e5);
    white-space: nowrap;
}

@media (min-width: 992px) {
    .sticky-atc-bar {
        display: none !important;
    }
}


/* ═══════════════════════════════════════════════════════════════════════════
   8. CHECKOUT STEP PROGRESS
   ═══════════════════════════════════════════════════════════════════════════ */

.checkout-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 2rem;
    padding: 0 1rem;
    counter-reset: step;
}

.checkout-step {
    display: flex;
    align-items: center;
    flex: 1;
    max-width: 180px;
    position: relative;
}

.checkout-step:not(:last-child)::after {
    content: '';
    flex: 1;
    height: 2px;
    background: var(--sw-border, #e2e8f0);
    margin: 0 .5rem;
    transition: background .4s ease;
}

.checkout-step.completed:not(:last-child)::after {
    background: var(--sw-accent, #4f46e5);
}

.step-bubble {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--sw-bg-secondary, #f1f5f9);
    border: 2px solid var(--sw-border, #e2e8f0);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .85rem;
    color: var(--sw-text-secondary, #64748b);
    transition: all .3s ease;
    flex-shrink: 0;
}

.checkout-step.active .step-bubble {
    background: var(--sw-accent, #4f46e5);
    border-color: var(--sw-accent, #4f46e5);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, .2);
}

.checkout-step.completed .step-bubble {
    background: #10b981;
    border-color: #10b981;
    color: #fff;
}

.step-label {
    position: absolute;
    bottom: -1.4rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: .7rem;
    font-weight: 600;
    white-space: nowrap;
    color: var(--sw-text-secondary, #64748b);
}

.checkout-step.active .step-label {
    color: var(--sw-accent, #4f46e5);
}

.checkout-step.completed .step-label {
    color: #10b981;
}

@media (max-width: 575.98px) {
    .checkout-step {
        max-width: 120px;
    }

    .step-label {
        bottom: -1.1rem;
        font-size: .62rem;
        white-space: normal;
        text-align: center;
    }
}

/* Step panels */
.checkout-panel {
    display: none;
    animation: fadeInUp .2s ease;
}

.checkout-panel.active {
    display: block;
}

/* Step nav buttons */
.step-nav {
    display: flex;
    gap: .75rem;
    justify-content: space-between;
    margin-top: 1.5rem;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ═══════════════════════════════════════════════════════════════════════════
   9. TRUST INDICATORS
   ═══════════════════════════════════════════════════════════════════════════ */

.trust-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    padding: .75rem;
    background: var(--sw-bg-secondary, #f8fafc);
    border-radius: .75rem;
    font-size: .8rem;
    color: var(--sw-text-secondary, #64748b);
}

.trust-item {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-weight: 500;
}

.trust-item i {
    color: #10b981;
}


/* ═══════════════════════════════════════════════════════════════════════════
   10. QUANTITY PICKER
   ═══════════════════════════════════════════════════════════════════════════ */

.qty-picker {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--sw-border, #e2e8f0);
    border-radius: .6rem;
    overflow: hidden;
}

.qty-picker button {
    background: none;
    border: none;
    padding: .4rem .8rem;
    font-size: 1rem;
    color: var(--sw-text-primary, #0f172a);
    cursor: pointer;
    transition: background .15s;
}

.qty-picker button:hover {
    background: var(--sw-hover-bg, #f1f5f9);
}

.qty-picker input {
    border: none;
    text-align: center;
    width: 48px;
    font-weight: 600;
    background: none;
    color: inherit;
}

.qty-picker input:focus {
    outline: none;
}


/* ═══════════════════════════════════════════════════════════════════════════
   11. TOAST UPGRADES
   ═══════════════════════════════════════════════════════════════════════════ */

.toast-container {
    pointer-events: none;
}

.toast-container .toast {
    pointer-events: all;
}

.sw-toast {
    min-width: 260px;
    border-radius: .75rem !important;
    border: none !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .18) !important;
}

.sw-toast-success {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: #fff !important;
}

.sw-toast-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    color: #fff !important;
}

.sw-toast-info {
    background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
    color: #fff !important;
}

.sw-toast-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    color: #fff !important;
}