/**
 * Cart Drawer Styles
 * Following Aeternity UI Design Guidelines
 */

/* ===========================
   Cart Drawer Container
   =========================== */
.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;
}

/* Overlay */
.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;
}

/* Drawer Content */
.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
   =========================== */
.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);
}

/* Close Button - Unified Modal Style */
.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 Icon Container */
.cart-drawer-close::before,
.cart-drawer-close::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 2.5px;
    background-color: #333;
    transition: all 0.2s ease;
}

/* First Line (top-left to bottom-right) */
.cart-drawer-close::before {
    transform: rotate(45deg);
}

/* Second Line (top-right to bottom-left) */
.cart-drawer-close::after {
    transform: rotate(-45deg);
}

/* Remove default focus styles */
.cart-drawer-close:focus {
    outline: none;
}

/* Hover and focus effects */
.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
   =========================== */
.cart-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

/* Scrollbar Styles */
.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 List
   =========================== */
.cart-items {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Empty Cart State */
.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: 14px 30px;
    background: #7F9688;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
}

.cart-continue-shopping:hover:not(:disabled) {
    background: rgba(127, 150, 136, 0.85);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(127, 150, 136, 0.4);
}

/* ===========================
   Cart Item Card
   =========================== */
.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: 4px;
    transition: all 0.2s ease;
}

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

/* Product Image */
.cart-item-image {
    width: 80px;
    height: 80px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--bg-light, #f9fafb);
}

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

/* Product Details */
.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);
}

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

/* Quantity Adjustment */
.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: 4px;
    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);
}

/* Optimistic update feedback */
.quantity-btn.updating {
    animation: pulse-subtle 0.3s ease-in-out;
}

@keyframes pulse-subtle {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(0.95);
        opacity: 0.7;
    }
}

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

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

.cart-item-remove:hover {
    background: #fef3c7;
    color: #d97706;
}

/* ===========================
   Cart Drawer Footer
   =========================== */
.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: 4px;
    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;
}

/* ===========================
   Responsive Design
   =========================== */

/* Tablet (≤991px) - Consistent with navbar breakpoint */
@media (max-width: 991px) {
    .cart-drawer-content {
        top: 60px; /* 平板端导航栏高度 */
    }
}

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

/* Smaller Screens (≤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;
    }
    
    /* Mobile Checkout Button Optimization */
    .cart-checkout-btn {
        padding: 0.875rem 1.25rem;
        font-size: 1rem;
    }
}

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

/* ===========================
   Dark Mode Support (Optional)
   =========================== */
@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;
    }
    
    /* Close Button in Dark Mode */
    .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;
    }
}

