/**
 * ============================================================================
 * Brccfaka 购物车浮动组件样式 - Riniba 01 Theme
 * ============================================================================
 * Template: Toy Store
 * Colors: #FBC270 (Primary/Accent), #67D4E0 (Secondary/Background)
 * Font: Nunito, Lato, Inter
 * Style: Playful, rounded corners, soft shadows
 * PC端: 右上角hover展开
 * 移动端: 右下角固定挂件
 * ============================================================================
 */

/* ============================================================================
   移动端浮动购物车按钮
   ============================================================================ */
.cart-float-mobile {
    display: none;
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #67D4E0 0%, #4FC3D0 100%);
    border-radius: 50%;
    box-shadow: 0 8px 30px rgba(103, 212, 224, 0.5);
    cursor: pointer;
    z-index: 1040;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.cart-float-mobile:hover {
    transform: scale(1.1) translateY(-3px);
    box-shadow: 0 12px 40px rgba(103, 212, 224, 0.6);
}

.cart-float-mobile:active {
    transform: scale(0.95);
}

.cart-float-mobile-inner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.cart-float-mobile-icon {
    color: #fff;
    font-size: 24px;
    transition: transform 0.3s ease;
}

.cart-float-mobile:hover .cart-float-mobile-icon {
    transform: scale(1.1);
}

.cart-float-mobile-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    font-size: 12px;
    font-weight: 700;
    font-family: 'Nunito', sans-serif;
    color: #fff;
    background: linear-gradient(135deg, #FBC270 0%, #E8A94D 100%);
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    box-shadow: 0 4px 12px rgba(251, 194, 112, 0.5);
    animation: cartFloatBadgePulse 2s ease-in-out infinite;
}

.cart-float-mobile-badge.empty {
    display: none;
}

@keyframes cartFloatBadgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ============================================================================
   移动端购物车抽屉 (Drawer)
   ============================================================================ */
.cart-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(44, 45, 47, 0.6);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    z-index: 1050;
    transition: all 0.3s ease;
}

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

.cart-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: 340px;
    max-width: 90vw;
    height: 100%;
    background: #fff;
    z-index: 1051;
    transition: right 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 50px rgba(0, 0, 0, 0.2);
}

.cart-drawer.show {
    right: 0;
}

.cart-drawer-header {
    padding: 20px;
    background: linear-gradient(135deg, #67D4E0 0%, #4FC3D0 100%);
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-drawer-header h4 {
    margin: 0;
    font-family: 'Nunito', sans-serif;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
}

.cart-drawer-header h4 i {
    margin-right: 10px;
    font-size: 22px;
}

.cart-drawer-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    padding: 0 8px;
    margin-left: 10px;
    background: rgba(255, 255, 255, 0.3);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    border-radius: 13px;
}

.cart-drawer-close {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.cart-drawer-close:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: rotate(90deg);
}

.cart-drawer-items {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.cart-drawer-items::-webkit-scrollbar {
    width: 6px;
}

.cart-drawer-items::-webkit-scrollbar-track {
    background: #f5f5f5;
}

.cart-drawer-items::-webkit-scrollbar-thumb {
    background: #67D4E0;
    border-radius: 3px;
}

/* 抽屉内商品项 */
.cart-drawer-item {
    display: flex;
    align-items: flex-start;
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.3s ease;
}

.cart-drawer-item:hover {
    background: #f9f9f9;
}

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

.cart-drawer-item-image {
    flex-shrink: 0;
    width: 70px;
    height: 70px;
    margin-right: 15px;
    border-radius: 12px;
    overflow: hidden;
    background: #f5f5f5;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.cart-drawer-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.cart-drawer-item:hover .cart-drawer-item-image img {
    transform: scale(1.1);
}

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

.cart-drawer-item-name {
    margin: 0 0 6px;
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #2C2D2F;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cart-drawer-item-spec {
    font-size: 12px;
    color: #888;
    padding: 2px 8px;
    background: #f5f5f5;
    border-radius: 4px;
    margin-bottom: 8px;
    display: inline-block;
}

.cart-drawer-item-price {
    font-family: 'Nunito', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #FBC270;
}

.cart-drawer-item-price .currency {
    font-size: 12px;
    margin-right: 2px;
}

.cart-drawer-item-quantity {
    font-size: 13px;
    color: #666;
    margin-left: 10px;
}

.cart-drawer-item-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-left: 10px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 50%;
    color: #999;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    align-self: center;
}

.cart-drawer-item-remove:hover {
    background: #ff5252;
    border-color: #ff5252;
    color: #fff;
    transform: rotate(90deg);
}

/* 抽屉底部 */
.cart-drawer-footer {
    padding: 20px;
    background: #fafafa;
    border-top: 1px solid #eee;
}

.cart-drawer-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px dashed #ddd;
}

.cart-drawer-total-label {
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #666;
}

.cart-drawer-total-amount {
    font-family: 'Nunito', sans-serif;
    font-size: 24px;
    font-weight: 800;
    color: #FBC270;
}

.cart-drawer-total-amount .currency {
    font-size: 14px;
    margin-right: 2px;
}

.cart-drawer-buttons {
    display: flex;
    gap: 12px;
}

.cart-drawer-view-btn,
.cart-drawer-checkout-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 20px;
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 25px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cart-drawer-view-btn {
    background: #fff;
    color: #67D4E0;
    border: 2px solid #67D4E0;
}

.cart-drawer-view-btn:hover {
    background: #67D4E0;
    color: #fff;
}

.cart-drawer-checkout-btn {
    background: linear-gradient(135deg, #FBC270 0%, #E8A94D 100%);
    color: #fff;
    box-shadow: 0 6px 20px rgba(251, 194, 112, 0.4);
}

.cart-drawer-checkout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(251, 194, 112, 0.5);
    color: #fff;
}

.cart-drawer-checkout-btn i {
    margin-left: 8px;
}

/* 抽屉空状态 */
.cart-drawer-empty {
    padding: 50px 20px;
    text-align: center;
}

.cart-drawer-empty-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #67D4E0 0%, #4FC3D0 100%);
    border-radius: 50%;
    box-shadow: 0 8px 25px rgba(103, 212, 224, 0.4);
}

.cart-drawer-empty-icon i {
    font-size: 36px;
    color: #fff;
}

.cart-drawer-empty-title {
    margin: 0 0 10px;
    font-family: 'Nunito', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: #2C2D2F;
}

.cart-drawer-empty-text {
    margin: 0 0 20px;
    font-size: 14px;
    color: #888;
    line-height: 1.6;
}

.cart-drawer-empty-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 30px;
    background: linear-gradient(135deg, #FBC270 0%, #E8A94D 100%);
    color: #fff;
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 25px;
    box-shadow: 0 6px 20px rgba(251, 194, 112, 0.4);
    transition: all 0.3s ease;
}

.cart-drawer-empty-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(251, 194, 112, 0.5);
    color: #fff;
}

.cart-drawer-empty-btn i {
    margin-right: 8px;
}

/* ============================================================================
   加入购物车动画
   ============================================================================ */
.add-to-cart-fly {
    position: fixed;
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: linear-gradient(135deg, #67D4E0 0%, #4FC3D0 100%);
    z-index: 9999;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 25px rgba(103, 212, 224, 0.5);
}

.add-to-cart-fly i {
    color: #fff;
    font-size: 20px;
}

/* 购物车晃动效果 */
.cart-shake {
    animation: cartShake 0.5s ease-in-out;
}

@keyframes cartShake {
    0%, 100% { transform: translateX(0) rotate(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-3px) rotate(-3deg); }
    20%, 40%, 60%, 80% { transform: translateX(3px) rotate(3deg); }
}

/* Toast通知 - 匹配主题风格 */
.cart-toast {
    position: fixed;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: linear-gradient(135deg, #2C2D2F 0%, #1a1a1a 100%);
    color: #fff;
    padding: 14px 28px;
    border-radius: 30px;
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 9999;
    white-space: nowrap;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.cart-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.cart-toast i {
    margin-right: 10px;
}

.cart-toast.success i {
    color: #67D4E0;
}

.cart-toast.error i {
    color: #ff5252;
}

.cart-toast.warning i {
    color: #FBC270;
}

/* ============================================================================
   响应式设计
   ============================================================================ */
@media (max-width: 991px) {
    .cart-float-mobile {
        display: block;
    }
}

@media (min-width: 992px) {
    .cart-float-mobile {
        display: none !important;
    }
    
    .cart-drawer-overlay,
    .cart-drawer {
        display: none !important;
    }
}

@media (max-width: 575px) {
    .cart-float-mobile {
        width: 54px;
        height: 54px;
        bottom: 80px;
        right: 15px;
    }
    
    .cart-float-mobile-icon {
        font-size: 22px;
    }
    
    .cart-drawer {
        width: 100%;
        max-width: 100%;
    }
    
    .cart-toast {
        left: 15px;
        right: 15px;
        transform: translateX(0) translateY(100px);
        text-align: center;
    }
    
    .cart-toast.show {
        transform: translateX(0) translateY(0);
    }
}

/* 防止滚动时body滚动 */
body.cart-drawer-open {
    overflow: hidden;
}
