/**
 * Mini Cart Drawer - Premium Design
 * Slides in from right when product added to cart
 * @package DJI_Market
 */

/* =================================================================
   CART DRAWER OVERLAY
   ================================================================= */
.cart-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999998 !important;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

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

/* =================================================================
   CART DRAWER CONTAINER
   ================================================================= */
.cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 420px;
    height: 100vh;
    height: 100dvh;
    background: #fff;
    z-index: 999999 !important;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15);
}

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

/* =================================================================
   CART DRAWER HEADER
   ================================================================= */
.cart-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
    flex-shrink: 0;
}

.cart-drawer-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.cart-drawer-title-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-drawer-title-icon svg {
    width: 22px;
    height: 22px;
    color: #0f172a;
}

.cart-drawer-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: #0f172a;
    color: white;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
}

.cart-drawer-close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: #f1f5f9;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #64748b;
}

.cart-drawer-close:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.cart-drawer-close svg {
    width: 20px;
    height: 20px;
}

/* =================================================================
   SUCCESS MESSAGE (After adding to cart)
   ================================================================= */
.cart-drawer-success {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    flex-shrink: 0;
}

.cart-drawer-success.is-visible {
    display: flex;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cart-drawer-success-icon {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cart-drawer-success-icon svg {
    width: 18px;
    height: 18px;
}

.cart-drawer-success-text {
    flex: 1;
}

.cart-drawer-success-title {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 2px;
}

.cart-drawer-success-product {
    font-size: 13px;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* =================================================================
   CART DRAWER CONTENT (Scrollable)
   ================================================================= */
.cart-drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

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

.cart-drawer-empty-icon {
    width: 80px;
    height: 80px;
    background: #f1f5f9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.cart-drawer-empty-icon svg {
    width: 40px;
    height: 40px;
    color: #94a3b8;
}

.cart-drawer-empty-title {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 8px 0;
}

.cart-drawer-empty-text {
    font-size: 14px;
    color: #64748b;
    margin: 0 0 24px 0;
}

.cart-drawer-empty-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #16436f, #0f2f4f);
    color: white;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
}

.cart-drawer-empty-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(22, 67, 111, 0.3);
    color: white;
}

/* =================================================================
   CART ITEMS
   ================================================================= */
.cart-drawer-items {
    padding: 16px 0;
}

.cart-drawer-item {
    display: flex;
    gap: 16px;
    padding: 16px 24px;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.2s ease;
}

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

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

.cart-drawer-item-image {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    overflow: hidden;
    background: #f8fafc;
    flex-shrink: 0;
}

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

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

.cart-drawer-item-name {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 4px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cart-drawer-item-name a {
    color: inherit;
    text-decoration: none;
}

.cart-drawer-item-name a:hover {
    color: #16436f;
}

.cart-drawer-item-meta {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 8px;
}

.cart-drawer-item-price {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.cart-drawer-item-price .price {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
}

.cart-drawer-item-price .price del {
    color: #94a3b8;
    font-weight: 400;
    font-size: 13px;
}

.cart-drawer-item-price .price ins {
    text-decoration: none;
    color: #10b981;
}

.cart-drawer-item-qty {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 4px;
}

.cart-drawer-item-qty button {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s ease;
}

.cart-drawer-item-qty button:hover {
    background: #16436f;
    color: white;
}

.cart-drawer-item-qty span {
    min-width: 32px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
}

.cart-drawer-item-remove {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    color: #94a3b8;
    transition: all 0.2s ease;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 4px;
}

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

.cart-drawer-item-remove svg {
    width: 18px;
    height: 18px;
}

/* =================================================================
   CART DRAWER FOOTER
   ================================================================= */
.cart-drawer-footer {
    padding: 20px 24px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.cart-drawer-totals {
    margin-bottom: 16px;
}

.cart-drawer-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.cart-drawer-total-row.subtotal {
    border-bottom: 1px dashed #e2e8f0;
    padding-bottom: 12px;
    margin-bottom: 12px;
}

.cart-drawer-total-label {
    font-size: 14px;
    color: #64748b;
}

.cart-drawer-total-value {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
}

.cart-drawer-total-row.total .cart-drawer-total-label {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
}

.cart-drawer-total-row.total .cart-drawer-total-value {
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
}

.cart-drawer-shipping-note {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #f0fdf4;
    border-radius: 8px;
    margin-bottom: 16px;
}

.cart-drawer-shipping-note svg {
    width: 18px;
    height: 18px;
    color: #10b981;
    flex-shrink: 0;
}

.cart-drawer-shipping-note span {
    font-size: 13px;
    color: #166534;
}

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

.cart-drawer-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 24px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
}

.cart-drawer-btn-primary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.cart-drawer-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
    color: white;
}

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

.cart-drawer-btn-secondary:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.cart-drawer-btn svg {
    width: 20px;
    height: 20px;
}

/* Continue Shopping Link */
.cart-drawer-continue {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px;
    font-size: 14px;
    color: #64748b;
    text-decoration: none;
    transition: color 0.2s ease;
}

.cart-drawer-continue:hover {
    color: #16436f;
}

/* =================================================================
   RESPONSIVE DESIGN
   ================================================================= */
@media (max-width: 480px) {
    .cart-drawer {
        max-width: 100%;
    }
    
    .cart-drawer-header {
        padding: 16px 20px;
    }
    
    .cart-drawer-item {
        padding: 14px 20px;
        gap: 12px;
    }
    
    .cart-drawer-item-image {
        width: 64px;
        height: 64px;
    }
    
    .cart-drawer-footer {
        padding: 16px 20px;
    }
}

/* =================================================================
   BODY SCROLL LOCK
   ================================================================= */
body.cart-drawer-open {
    overflow: hidden;
}

/* =================================================================
   ADD TO CART SUCCESS ANIMATION
   ================================================================= */
.cart-drawer-item.just-added {
    animation: highlightItem 1.5s ease;
}

@keyframes highlightItem {
    0% {
        background: rgba(16, 185, 129, 0.1);
    }
    100% {
        background: transparent;
    }
}
