/**
 * floating-cart.css
 * Scope: Floating side cart trigger, responsive fly-to-cart animation, and Anti-Gravity V3.2 Solidism drawer.
 * Standards: Anti-Gravity V3.2 (Zero-Pill, Zero-Border Elevation, Mathematical Shadow Tokens, 100% Solid Surfaces)
 */

/* ── 1. Floating Cart Trigger Widget ── */
.floating-cart-widget {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    width: 48px;
    height: 64px;
    background: var(--pb-primary, #0D5C3A);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 6px 0 0 6px;
    box-shadow: -2px 0 10px 0 rgba(99, 99, 99, 0.25);
    z-index: 9998;
    text-decoration: none;
    border: 0;
    transition: transform 0.2s ease, width 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.floating-cart-widget:hover {
    color: #ffffff;
    width: 52px;
    box-shadow: -3px 0 16px 0 rgba(99, 99, 99, 0.35);
}

.floating-cart-widget:active {
    transform: translateY(-50%) translateX(2px);
}

.floating-cart-widget i {
    font-size: 20px;
    color: #ffffff;
    margin-top: 4px;
}

.floating-cart-badge {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    min-width: 22px;
    height: 20px;
    background: #ffffff;
    color: var(--pb-primary, #0D5C3A);
    font-size: 11px;
    font-weight: 700;
    border-radius: 4px;
    box-shadow: 0 2px 6px 0 rgba(99, 99, 99, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 0;
    line-height: 1;
}

@media (max-width: 768px) {
    .floating-cart-widget {
        top: 38%;
        width: 44px;
        height: 56px;
        z-index: 9999;
    }
    .floating-cart-widget i {
        font-size: 18px;
    }
    .floating-cart-badge {
        min-width: 20px;
        height: 18px;
        font-size: 10px;
        top: -7px;
    }
}

/* ── 2. Sidebar Cart Overlay ── */
.sidebar-cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 10010;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ── 3. Sidebar Cart Drawer Architecture ── */
.sidebar-cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 380px;
    max-width: 92vw;
    height: 100%;
    height: 100dvh;
    background: #ffffff;
    z-index: 10011;
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s ease;
    box-shadow: -4px 0 24px 0 rgba(99, 99, 99, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 0;
}

.sidebar-cart-drawer.active {
    transform: translateX(0);
    visibility: visible;
}

#sidebarCartContent {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── 4. Internal Drawer Sections ── */
.sidebar-cart-header {
    background: #ffffff;
    padding: 14px 16px;
    border-bottom: 1px solid #F1F5F9;
    flex-shrink: 0;
}

.sidebar-cart-title {
    font-size: 16px;
    font-weight: 700;
    color: #0F172A;
    margin: 0;
}

.sidebar-cart-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 14px;
    background: #F8FAFC;
    scrollbar-width: thin;
    scrollbar-color: #CBD5E1 transparent;
}

.sidebar-cart-body::-webkit-scrollbar {
    width: 5px;
}

.sidebar-cart-body::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 4px;
}

.sidebar-cart-item {
    background: #ffffff;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px 0 rgba(99, 99, 99, 0.2);
    border: 0;
    display: flex;
    gap: 12px;
    position: relative;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.sidebar-cart-item:hover {
    box-shadow: 0 4px 12px 0 rgba(99, 99, 99, 0.25);
}

.sidebar-cart-item-img {
    width: 64px;
    height: 78px;
    border-radius: 4px;
    overflow: hidden;
    background: #F8FAFC;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-cart-item-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sidebar-cart-item-title {
    font-size: 13px;
    font-weight: 600;
    color: #0F172A;
    text-decoration: none;
    line-height: 1.35;
    margin-bottom: 2px;
    display: block;
}

.sidebar-cart-item-title:hover {
    color: var(--pb-primary, #0D5C3A);
}

.sidebar-cart-qty {
    display: inline-flex;
    align-items: center;
    background: #F8FAFC;
    border-radius: 4px;
    border: 0;
    box-shadow: 0 1px 3px 0 rgba(99, 99, 99, 0.15);
    overflow: hidden;
}

.sidebar-qty-btn {
    width: 26px;
    height: 26px;
    background: #F1F5F9;
    color: #334155;
    font-size: 13px;
    font-weight: 700;
    border: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
}

.sidebar-qty-btn:hover {
    background: #E2E8F0;
    color: #0F172A;
}

.sidebar-qty-btn:active {
    transform: translateY(1px);
}

.sidebar-qty-num {
    min-width: 26px;
    height: 26px;
    background: #ffffff;
    color: #0F172A;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.sidebar-cart-footer {
    padding: 16px;
    background: #ffffff;
    border-top: 1px solid #F1F5F9;
    box-shadow: 0 -4px 12px 0 rgba(99, 99, 99, 0.06);
    flex-shrink: 0;
}

.sidebar-cart-checkout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 20px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    border: 0;
    box-shadow: 0 2px 8px 0 rgba(99, 99, 99, 0.2);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.sidebar-cart-checkout-btn:active {
    transform: translateY(1px);
}

@media (max-width: 768px) {
    .sidebar-cart-drawer {
        width: 100%;
        max-width: 100%;
    }
    .sidebar-cart-header {
        padding: 12px 14px;
    }
    .sidebar-cart-body {
        padding: 10px;
    }
    .sidebar-cart-footer {
        padding: 12px 14px;
    }
}

/* ── 5. Fly to Cart Animation ── */
.fly-to-cart-img {
    position: fixed;
    z-index: 99999;
    pointer-events: none;
    border-radius: 6px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    object-fit: cover;
    border: 2px solid #ffffff;
}

@keyframes cartBump {
    0% { transform: scale(1); }
    40% { transform: scale(1.2); }
    70% { transform: scale(0.96); }
    100% { transform: scale(1); }
}

.cart-bump-animate {
    animation: cartBump 0.4s ease-out;
}

.menu-bag a, .mobile_bottom_nav .nav_item .icon_box {
    transform-origin: center center;
}
