/**
 * Cart Drawer Styles
 * 遵循 Aeternity UI 设计规范
 */

/* ===========================
   购物车抽屉容器
   =========================== */
.cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cart-drawer.open {
    pointer-events: all;
    opacity: 1;
}

/* 遮罩层 */
.cart-drawer-overlay {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cart-drawer.open .cart-drawer-overlay {
    opacity: 1;
}

/* 抽屉内容 */
.cart-drawer-content {
    position: absolute;
    top: 80px; 
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 450px;
    background: var(--background-color, #ffffff);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ===========================
   购物车头部
   =========================== */
.cart-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.cart-drawer-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary, #1f2937);
}

/* 关闭按钮 - 统一 Modal 风格 */
.cart-drawer-close {
    position: relative;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 0;
}

/* X 图标容器 */
.cart-drawer-close::before,
.cart-drawer-close::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 2.5px;
    background-color: #333;
    transition: all 0.2s ease;
}

/* 第一条线 (左上到右下) */
.cart-drawer-close::before {
    transform: rotate(45deg);
}

/* 第二条线 (右上到左下) */
.cart-drawer-close::after {
    transform: rotate(-45deg);
}

/* 移除默认焦点样式 */
.cart-drawer-close:focus {
    outline: none;
}

/* 悬停和焦点效果 */
.cart-drawer-close:hover,
.cart-drawer-close:focus {
    background: #fff;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.cart-drawer-close:hover::before,
.cart-drawer-close:hover::after,
.cart-drawer-close:focus::before,
.cart-drawer-close:focus::after {
    background-color: #000;
}

/* ===========================
   购物车主体
   =========================== */
.cart-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

/* 滚动条样式 */
.cart-drawer-body::-webkit-scrollbar {
    width: 8px;
}

.cart-drawer-body::-webkit-scrollbar-track {
    background: var(--background-color, #ffffff);
}

.cart-drawer-body::-webkit-scrollbar-thumb {
    background: var(--border-color, #e5e7eb);
    border-radius: 4px;
}

.cart-drawer-body::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary, #9ca3af);
}

/* ===========================
   购物车商品列表
   =========================== */
.cart-items {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* 空购物车状态 */
.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
}

.cart-empty svg {
    color: var(--text-tertiary, #9ca3af);
    margin-bottom: 1rem;
}

.cart-empty-text {
    font-size: 1.125rem;
    color: var(--text-secondary, #6b7280);
    margin-bottom: 1.5rem;
}

.cart-continue-shopping {
    padding: 0.75rem 2rem;
    background: var(--primary-color, #2563eb);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cart-continue-shopping:hover {
    background: var(--primary-hover, #1d4ed8);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* ===========================
   购物车商品卡片
   =========================== */
.cart-item {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 1rem;
    padding: 1rem;
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.cart-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* 商品图片 */
.cart-item-image {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-light, #f9fafb);
}

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

/* 商品详情 */
.cart-item-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.25rem;
}

.cart-item-title {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary, #1f2937);
    line-height: 1.4;
}

.cart-item-variant {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary, #6b7280);
}

.cart-item-price {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color, #2563eb);
}

/* 商品操作 */
.cart-item-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.5rem;
}

/* 数量调整 */
.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-light, #f9fafb);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 6px;
    padding: 0.25rem;
}

.quantity-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: white;
    border: none;
    border-radius: 4px;
    color: var(--text-primary, #1f2937);
    cursor: pointer;
    transition: all 0.2s ease;
}

.quantity-btn:hover {
    background: var(--primary-color, #2563eb);
    color: white;
}

.quantity-btn:active {
    transform: scale(0.95);
}

.quantity-value {
    min-width: 32px;
    text-align: center;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary, #1f2937);
}

/* 删除按钮 */
.cart-item-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--text-tertiary, #9ca3af);
    cursor: pointer;
    transition: all 0.2s ease;
}

.cart-item-remove:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* ===========================
   购物车底部
   =========================== */
.cart-drawer-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color, #e5e7eb);
    background: var(--bg-light, #f9fafb);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.cart-total-label {
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--text-secondary, #6b7280);
}

.cart-total-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary, #1f2937);
}

.cart-shipping-notice {
    margin: 0 0 1rem 0;
    font-size: 0.875rem;
    color: var(--text-tertiary, #9ca3af);
    text-align: center;
}

.cart-checkout-btn {
    width: 100%;
    padding: 1rem 1.5rem;
    background: #333333; /* 深灰色，与网站导航链接颜色一致 */
    color: #ffffff;
    border: 2px solid #333333;
    border-radius: 8px;
    font-size: 1.0625rem;
    font-weight: 600;
    font-family: 'Century Gothic Bold', sans-serif;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.cart-checkout-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.cart-checkout-btn:hover {
    background: #1a1a1a; /* 更深的黑色 */
    border-color: #1a1a1a;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.cart-checkout-btn:hover::before {
    width: 300px;
    height: 300px;
}

.cart-checkout-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.cart-checkout-btn:disabled {
    background: #e5e7eb;
    border-color: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===========================
   响应式设计
   =========================== */

/* 平板端 (≤991px) - 与导航栏断点一致 */
@media (max-width: 991px) {
    .cart-drawer-content {
        top: 60px; /* 平板端导航栏高度 */
    }
}

/* 小屏幕 (≤767px) */
@media (max-width: 767px) {
    .cart-drawer-content {
        max-width: 100%;
        top: 50px; /* 小屏幕导航栏高度 */
    }
}

/* 更小屏幕 (≤480px) */
@media (max-width: 480px) {
    .cart-drawer-content {
        top: 45px; /* 更小屏幕导航栏高度 */
    }
    
    .cart-item {
        grid-template-columns: 70px 1fr auto;
    }
    
    .cart-item-image {
        width: 70px;
        height: 70px;
    }
    
    .cart-item-title {
        font-size: 0.875rem;
    }
    
    /* 移动端 Checkout 按钮优化 */
    .cart-checkout-btn {
        padding: 0.875rem 1.25rem;
        font-size: 1rem;
    }
}

/* 超小屏幕 (≤360px) */
@media (max-width: 360px) {
    .cart-drawer-content {
        top: 40px; /* 超小屏幕导航栏高度 */
    }
    
    .cart-drawer-title {
        font-size: 1.25rem;
    }
    
    /* 超小屏 Checkout 按钮优化 */
    .cart-checkout-btn {
        padding: 0.75rem 1rem;
        font-size: 0.9375rem;
    }
}

/* ===========================
   深色模式支持（可选）
   =========================== */
@media (prefers-color-scheme: dark) {
    .cart-drawer-content {
        background: #1f2937;
    }
    
    .cart-drawer-header,
    .cart-drawer-footer {
        border-color: #374151;
    }
    
    .cart-drawer-title {
        color: #f9fafb;
    }
    
    .cart-item {
        background: #111827;
        border-color: #374151;
    }
    
    .cart-item-title {
        color: #f9fafb;
    }
    
    .cart-item-price {
        color: #60a5fa;
    }
    
    /* 深色模式下的关闭按钮 */
    .cart-drawer-close {
        background: rgba(55, 65, 81, 0.95);
    }
    
    .cart-drawer-close::before,
    .cart-drawer-close::after {
        background-color: #f9fafb;
    }
    
    .cart-drawer-close:hover,
    .cart-drawer-close:focus {
        background: #374151;
    }
    
    .cart-drawer-close:hover::before,
    .cart-drawer-close:hover::after,
    .cart-drawer-close:focus::before,
    .cart-drawer-close:focus::after {
        background-color: #fff;
    }
    
    .quantity-btn {
        background: #374151;
        color: #f9fafb;
    }
    
    .quantity-btn:hover {
        background: #2563eb;
    }
    
    .cart-total-amount {
        color: #f9fafb;
    }
    
    .cart-drawer-footer {
        background: #111827;
    }
}

