/* ==========================================================================
   AGORAmilk - Premium Side Cart Drawer & Micro-Animations
   ========================================================================== */

/* 1. Integrated Header Action Buttons (Search, Cart, Auth) */
.header-icon-btn {
    position: relative !important;
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
    box-sizing: border-box !important;
    border-radius: 50% !important;
    background: rgba(0, 75, 135, 0.05) !important;
    border: 1px solid rgba(0, 75, 135, 0.1) !important;
    color: var(--primary-blue, #004b87) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
    text-decoration: none !important;
}

.header-icon-btn:hover {
    background: #ffffff !important;
    color: var(--color-wild-orange, #f28c28) !important;
    border-color: rgba(242, 140, 40, 0.4) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 14px rgba(242, 140, 40, 0.2) !important;
}

.header-icon-btn svg {
    flex-shrink: 0 !important;
}

.header-cart-icon-btn {
    position: relative !important;
}

.header-cart-icon-btn .header-cart-badge {
    position: absolute !important;
    top: -4px !important;
    right: -4px !important;
    background: linear-gradient(135deg, #f28c28, #e67e22) !important;
    color: #ffffff !important;
    font-size: 10px !important;
    font-weight: 800 !important;
    height: 18px !important;
    min-width: 18px !important;
    padding: 0 4px !important;
    border-radius: 9px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    border: 2px solid #ffffff !important;
    box-shadow: 0 2px 6px rgba(242, 140, 40, 0.4) !important;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

.header-cart-badge.has-items {
    display: inline-flex !important;
}

.header-cart-badge.is-empty {
    display: none !important;
}

.header-cart-badge.bounce {
    animation: cartBadgeBounce 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

.header-auth-btn {
    text-decoration: none !important;
    color: var(--primary-blue, #004b87) !important;
    font-weight: 700 !important;
    font-size: 13px !important;
    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
    padding: 0 16px !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
    border-radius: 19px !important;
    background: rgba(0, 75, 135, 0.06) !important;
    transition: all 0.2s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
}

.header-auth-btn.is-avatar {
    width: 38px !important;
    min-width: 38px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    background: transparent !important;
}

.header-auth-btn:hover {
    background: rgba(0, 75, 135, 0.12) !important;
    color: var(--primary-blue, #004b87) !important;
    transform: translateY(-1px) !important;
}

.header-mobile-quick-actions {
    display: none;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    margin-right: 12px;
}

@media (max-width: 768px) {
    .header-mobile-quick-actions {
        display: flex !important;
    }
}

.header-cart-badge.has-items {
    display: inline-flex !important;
}

.header-cart-badge.is-empty {
    display: none !important;
}

.header-cart-badge.bounce {
    animation: cartBadgeBounce 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

@keyframes cartBadgeBounce {
    0% { transform: scale(1); }
    40% { transform: scale(1.4); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

/* 2. Drawer Backdrop Overlay */
.cart-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 100000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

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

/* 3. Side Cart Drawer Panel */
.cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 440px;
    max-width: 100vw;
    background: #ffffff;
    z-index: 100001;
    box-shadow: -10px 0 40px rgba(15, 23, 42, 0.18);
    display: flex;
    flex-direction: column;
    transform: translateX(105%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
    font-family: 'Montserrat', sans-serif;
}

.cart-drawer.is-open {
    transform: translateX(0);
}

/* 4. Drawer Header */
.cart-drawer-header {
    height: 72px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
    background: #ffffff;
}

.cart-drawer-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cart-drawer-title {
    font-size: 19px;
    font-weight: 800;
    color: #1a4a76;
    margin: 0;
    letter-spacing: -0.3px;
}

.drawer-count-badge {
    background: #f1f5f9;
    color: #1a4a76;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 12px;
}

.cart-drawer-close {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.cart-drawer-close:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #ef4444;
    transform: rotate(90deg);
}

/* 5. Free Shipping Progress Bar */
.cart-free-shipping-card {
    margin: 16px 20px 10px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #f0fdf4 0%, #f7fee7 100%);
    border: 1px solid #bbf7d0;
    border-radius: 14px;
    flex-shrink: 0;
}

.free-shipping-text {
    font-size: 13px;
    font-weight: 600;
    color: #166534;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.free-shipping-text strong {
    color: #15803d;
    font-weight: 800;
}

.free-shipping-bar-bg {
    width: 100%;
    height: 7px;
    background: #dcfce7;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.free-shipping-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
    border-radius: 10px;
    transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.free-shipping-bar-fill.is-complete {
    background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
}

/* 6. Items Scrollable List */
.cart-drawer-items {
    flex: 1;
    overflow-y: auto;
    padding: 10px 20px;
}

.cart-drawer-item {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid #f1f5f9;
    align-items: center;
    position: relative;
    transition: background-color 0.2s;
}

.cart-drawer-item:last-child {
    border-bottom: none;
}

.drawer-item-thumb {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.drawer-item-thumb img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.drawer-item-info {
    flex: 1;
    min-width: 0;
}

.drawer-item-title {
    font-size: 13.5px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 4px 0;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.drawer-item-price-unit {
    font-size: 12.5px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 8px;
}

.drawer-item-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.drawer-stepper {
    display: inline-flex;
    align-items: center;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 2px;
}

.drawer-step-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-weight: 700;
    font-size: 15px;
    color: #1a4a76;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s, color 0.15s;
}

.drawer-step-btn:hover {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.drawer-step-qty {
    min-width: 32px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
}

.drawer-item-total {
    font-size: 14.5px;
    font-weight: 800;
    color: #f28c28;
    font-variant-numeric: tabular-nums;
}

.drawer-item-remove {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 6px;
}

.drawer-item-remove:hover {
    color: #ef4444;
    background: #fee2e2;
}

/* Empty State */
.cart-drawer-empty {
    padding: 60px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.empty-cart-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #f1f5f9;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
}

.empty-cart-title {
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 6px 0;
}

.empty-cart-sub {
    font-size: 13.5px;
    color: #64748b;
    margin: 0 0 24px 0;
    max-width: 240px;
    line-height: 1.45;
}

.empty-cart-btn {
    background: #1a4a76;
    color: #ffffff;
    font-weight: 700;
    font-size: 14px;
    padding: 12px 24px;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(26, 74, 118, 0.2);
}

.empty-cart-btn:hover {
    background: #113254;
    color: #ffffff;
    transform: translateY(-2px);
}

/* 7. Drawer Footer */
.cart-drawer-footer {
    padding: 20px 24px;
    border-top: 1px solid #f1f5f9;
    background: #ffffff;
    flex-shrink: 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.03);
}

.cart-drawer-subtotal {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 16px;
}

.subtotal-label {
    font-size: 15px;
    font-weight: 700;
    color: #64748b;
}

.subtotal-amount {
    font-size: 22px;
    font-weight: 800;
    color: #1a4a76;
    font-variant-numeric: tabular-nums;
}

.cart-drawer-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.drawer-btn-checkout {
    background: linear-gradient(135deg, #1a4a76 0%, #0d3153 100%);
    color: #ffffff;
    font-weight: 700;
    font-size: 15px;
    padding: 14px 20px;
    border-radius: 12px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 8px 24px rgba(26, 74, 118, 0.25);
    transition: all 0.25s ease;
    border: none;
    cursor: pointer;
}

.drawer-btn-checkout:hover {
    background: linear-gradient(135deg, #113254 0%, #08213b 100%);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(26, 74, 118, 0.35);
}

.drawer-btn-view-cart {
    background: #f8fafc;
    color: #1a4a76;
    font-weight: 700;
    font-size: 14px;
    padding: 12px 20px;
    border-radius: 12px;
    text-decoration: none;
    text-align: center;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.drawer-btn-view-cart:hover {
    background: #f1f5f9;
    color: #0f172a;
}

/* 8. Flying Product Animation */
.flying-cart-item {
    position: fixed;
    z-index: 999999;
    pointer-events: none;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid var(--color-wild-orange, #f28c28);
    box-shadow: 0 12px 30px rgba(26, 74, 118, 0.35);
    padding: 4px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.65s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.65s ease;
}

.flying-cart-item img {
    border-radius: 50%;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* 9. Mobile Responsive adjustments */
@media (max-width: 576px) {
    .cart-drawer {
        width: 100vw;
        border-radius: 0;
    }
    .cart-free-shipping-card {
        margin: 12px 16px 8px;
    }
    .cart-drawer-items {
        padding: 8px 16px;
    }
    .cart-drawer-footer {
        padding: 16px;
    }
}
