﻿/* ===== COMPLETE CART DROPDOWN STYLES ===== */

/* Cart Dropdown Container */
.cart-dropdown,
.cart-section {
    position: relative;
}

/* Cart Panel - Hidden by default */
.cart-panel {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    min-width: 450px;
    max-width: 500px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(15px);
    transition: all 0.3s ease;
    margin-top: 15px;
    z-index: 1001;
    overflow: hidden;
    display: block;
}

/* Show cart when active class is added */
.cart-dropdown.active .cart-panel,
.cart-section.active .cart-panel,
#cart-dropdown.active .cart-panel,
#cart-dropdown.active > .cart-panel {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
}

/* Cart Header */
.cart-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
}

    .cart-header h5 {
        margin: 0;
        font-size: 16px;
        font-weight: 600;
    }

.cart-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

    .cart-close:hover {
        transform: rotate(90deg);
        opacity: 0.8;
    }

/* Cart Content */
.cart-content {
    max-height: 400px;
    overflow-y: auto;
}

/* Cart Empty State */
.cart-empty {
    padding: 40px 20px;
    text-align: center;
    color: #999;
}

    .cart-empty i {
        font-size: 48px;
        color: #ddd;
        margin-bottom: 15px;
        display: block;
    }

    .cart-empty p {
        font-size: 15px;
        margin-bottom: 5px;
    }

    .cart-empty small,
    .cart-empty small a {
        display: block;
        text-align: center;
        color: #666;
    }

        .cart-empty small a:hover {
            color: #667eea;
        }

.cart-badge {
    position: absolute;
    top: -8px;
    right: -10px;
    min-width: 20px;
    height: 20px;
    background: #ff6b6b;
    color: white;
    border-radius: 50%;
    font-size: 11px;
    font-weight: bold;
    line-height: 20px; /* ← match height exactly */
    text-align: center; /* ← horizontal centering */
    display: block; /* ← drop flex, use line-height trick instead */
    padding: 0 4px; /* ← allows 2-digit numbers to stretch naturally */
    box-sizing: border-box;
    pointer-events: none;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

/* Cart Item */
.cart-item {
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    transition: all 0.3s ease;
}

    .cart-item:hover {
        background: #f9f9f9;
    }

    .cart-item:last-child {
        border-bottom: none;
    }

/* Cart Item Image */
.cart-item-image {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
}

.cart-item-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    /*display: block;*/
}

/* Cart Item Details */
.cart-item-details {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    margin-bottom: 5px;
}

.cart-item-info {
    font-size: 12px;
    color: #999;
    margin-bottom: 8px;
}

.cart-item-options {
    font-size: 12px;
    color: #333;
    margin-bottom: 5px;
}

/* Highlight animation for newly added cart item */
.cart-item.highlight {
    animation: highlightCartItem 1.2s ease-in-out;
}

@keyframes highlightCartItem {
    0% {
        background-color: #ffff99;
    }

    50% {
        background-color: #fff3b3;
    }

    100% {
        background-color: transparent;
    }
}

/* Quantity Control */
.quantity-control {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.qty-btn {
    background: #f0f0f0;
    border: 1px solid #ddd;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    transition: all 0.3s ease;
    padding: 0;
}

    .qty-btn:hover {
        background: #667eea;
        color: white;
        border-color: #667eea;
    }

    .qty-btn:active {
        transform: scale(0.95);
    }

    .qty-btn:disabled {
        opacity: 0.4;
        cursor: not-allowed;
    }


.qty-display {
    font-weight: 600;
    color: #333;
    min-width: 30px;
    text-align: center;
    font-size: 14px;
    display: inline-block;
    transition: transform 0.2s ease, color 0.2s ease;
}

.qty-change {
    transform: scale(1.3);
    color: #2a9d8f;
}

@keyframes cartPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.25);
    }

    100% {
        transform: scale(1);
    }
}

.cart-badge-pulse {
    animation: cartPulse 0.35s ease;
}


/* Fade out removed cart item */
.cart-item.fade-out {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
/* Cart Item Price */
.cart-item-price {
    font-weight: 600;
    color: #667eea;
    font-size: 14px;
}

/* Cart Item Remove */
.cart-item-remove {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s ease;
    padding: 5px;
    line-height: 1;
}

    .cart-item-remove:hover {
        color: #ff4757;
        transform: scale(1.2);
    }

/* Cart Footer */
.cart-footer {
    padding: 15px 20px;
    border-top: 2px solid #f0f0f0;
    background: #f9f9f9;
}

/* Cart Total */
.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 15px;
}

.cart-total-label {
    color: #666;
    font-weight: 500;
}

.cart-total-price {
    font-size: 18px;
    font-weight: 700;
    color: #667eea;
}

/* Cart Actions */
.cart-actions {
    display: flex;
    gap: 10px;
}

    .cart-actions .view-cart,
    .cart-actions .checkout {
        flex: 1;
        padding: 10px;
        border: none;
        border-radius: 5px;
        text-decoration: none;
        cursor: pointer;
        font-size: 13px;
        font-weight: 600;
        transition: all 0.3s ease;
        text-align: center;
        min-width: 0;
        display: inline-block;
    }

    .cart-actions .view-cart {
        background: white;
        color: #667eea;
        border: 2px solid #667eea;
    }

        .cart-actions .view-cart:hover {
            background: #f0f0f0;
        }

    .cart-actions .checkout {
        background: #667eea;
        color: white;
        border: 2px solid #667eea;
    }

        .cart-actions .checkout:hover {
            background: #764ba2;
            border-color: #764ba2;
        }

/* Cart Overlay for Mobile */
.cart-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* ===== MOBILE RESPONSIVE CART ===== */

/* Tablet and below */
@media (max-width: 768px) {
    .cart-panel {
        /* Change to full-screen modal on mobile */
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        min-width: auto;
        max-width: none;
        width: 100%;
        height: 100vh;
        border-radius: 0;
        margin-top: 0;
        transform: translateX(100%);
        z-index: 9999;
    }

    .cart-dropdown.active .cart-panel,
    #cart-dropdown.active .cart-panel {
        transform: translateX(0) !important;
    }

    .cart-header {
        padding: 18px 20px;
        font-size: 18px;
    }

        .cart-header h5 {
            font-size: 18px;
        }

    .cart-content {
        max-height: calc(100vh - 200px);
        height: calc(100vh - 200px);
    }

    .cart-footer {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 20px;
        background: white;
        border-top: 2px solid #f0f0f0;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    }

    .cart-item {
        padding: 12px 15px;
    }

    .cart-item-image {
        width: 50px;
        height: 50px;
    }

    .cart-actions {
        flex-direction: column;
        gap: 12px;
    }

        .cart-actions .view-cart,
        .cart-actions .checkout {
            width: 100%;
            padding: 12px;
            font-size: 14px;
        }

    .cart-dropdown.active .cart-overlay,
    #cart-dropdown.active .cart-overlay {
        display: block;
        opacity: 1;
    }
}

/* Small mobile phones */
@media (max-width: 480px) {
    .cart-header {
        padding: 15px;
        font-size: 16px;
    }

        .cart-header h5 {
            font-size: 16px;
        }

    .cart-close {
        font-size: 20px;
        width: 26px;
        height: 26px;
    }

    .cart-content {
        max-height: calc(100vh - 180px);
        height: calc(100vh - 180px);
    }

    .cart-item {
        padding: 10px 12px;
        gap: 10px;
    }

    .cart-item-image {
        width: 45px;
        height: 45px;
    }

    .cart-item-name {
        font-size: 13px;
    }

    .cart-item-info {
        font-size: 11px;
    }

    .cart-item-options {
        font-size: 11px;
    }

    .qty-btn {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }

    .qty-display {
        min-width: 25px;
        font-size: 14px;
    }

    .cart-item-price {
        font-size: 13px;
    }

    .cart-footer {
        padding: 15px;
    }

    .cart-total {
        font-size: 14px;
    }

    .cart-total-price {
        font-size: 16px;
    }

    .cart-empty {
        padding: 30px 15px;
    }

        .cart-empty i {
            font-size: 40px;
        }

        .cart-empty p {
            font-size: 14px;
        }
}

/* Landscape mode for small phones */
@media (max-width: 768px) and (orientation: landscape) {
    .cart-content {
        max-height: calc(100vh - 160px);
        height: calc(100vh - 160px);
    }

    .cart-footer {
        padding: 12px 20px;
    }

    .cart-total {
        margin-bottom: 10px;
    }
}

/* Prevent body scroll when cart is open on mobile */
@media (max-width: 768px) {
    body.cart-open {
        overflow: hidden;
    }
}

/* === End Cart Dropdown === */
