/* cart.css - Professional Cart Styling */

/* Cart Dropdown Styling */
.cart-dropdown {
    min-width: 380px !important;
    max-width: 400px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
}

.cart-header {
    background-color: black;
    color: white;
    padding: 20px;
    text-align: center;
    position: relative;
}

.cart-header h6 {
    margin: 0;
    font-weight: 600;
    font-size: 1.2rem;
    letter-spacing: 0.5px;
}

.cart-body {
    padding: 0;
    max-height: 400px;
    overflow-y: auto;
}

.cart-empty-state {
    padding: 40px 20px;
    text-align: center;
}

.cart-empty-icon {
    font-size: 48px;
    color: #dee2e6;
    margin-bottom: 15px;
}

.cart-empty-state p {
    color: #6c757d;
    margin-bottom: 0;
}

/* Cart Item Styling */
.cart-item {
    padding: 16px;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
    position: relative;
}

.cart-item:hover {
    background-color: #f8f9fa;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.cart-item-content {
    flex: 1;
    min-width: 0;
}

.cart-item-title {
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
    font-size: 0.9rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cart-item-meta {
    font-size: 0.8rem;
    color: #666;
}

/* Quantity Controls */
.quantity-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qty-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid #dee2e6;
    background: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.qty-btn:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.qty-btn:active {
    transform: scale(0.95);
}

.qty-display {
    min-width: 32px;
    text-align: center;
    font-weight: 500;
    font-size: 14px;
    color: #333;
}

/* Remove Button */
.remove-btn {
    color: #dc3545;
    background: none;
    border: none;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.remove-btn:hover {
    background-color: #f8d7da;
}

/* Cart Footer */
.cart-footer {
    padding: 20px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    transition: all 0.3s ease;
}

.cart-summary {
    margin-bottom: 16px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.summary-label {
    color: #666;
    font-size: 0.9rem;
}

.summary-value {
    font-weight: 500;
    color: #333;
}

.cart-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    transition: all 0.3s ease;
}

/* Hide footer when cart is empty */
.cart-footer[style*="display: none"] {
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
}

/* Cart Badge */
.cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e8e 100%);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Toast Notifications */
.toast-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    min-width: 300px;
    pointer-events: none;
}

.toast-item {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 16px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-left: 4px solid;
    pointer-events: auto;
    animation: slideInRight 0.3s ease-out;
}

.toast-item.success {
    border-left-color: #28a745;
}

.toast-item.info {
    border-left-color: #17a2b8;
}

.toast-item.warning {
    border-left-color: #ffc107;
}

.toast-item.danger {
    border-left-color: #dc3545;
}

.toast-icon {
    font-size: 20px;
    width: 24px;
}

.toast-message {
    flex: 1;
    font-size: 0.9rem;
}

.toast-close {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.toast-close:hover {
    background-color: #f8f9fa;
}

/* Add to Cart Button Feedback Animation */
.btn-add-to-cart {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-add-to-cart .cart-icon {
    display: inline-block;
    transition: transform 0.3s ease;
}

.btn-add-to-cart.added .cart-icon {
    transform: scale(1.2);
    color: #28a745;
}

.btn-add-to-cart .check-icon {
    display: none;
    color: #28a745;
}

.btn-add-to-cart.added .check-icon {
    display: inline-block;
    animation: checkBounce 0.5s ease;
}

.btn-add-to-cart .cart-icon,
.btn-add-to-cart .check-icon {
    margin-right: 5px;
}

@keyframes checkBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

/* Feedback text animation */
.feedback-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    opacity: 0;
    transform: translateY(100%);
    transition: all 0.4s ease;
    font-weight: 600;
    font-size: 12px;
    z-index: 1;
}

.feedback-text.show {
    opacity: 1;
    transform: translateY(0);
}

.feedback-text.hide {
    opacity: 0;
    transform: translateY(-100%);
}

/* Button text container */
.btn-add-to-cart .button-text {
    position: relative;
    z-index: 2;
    transition: opacity 0.3s ease;
}

/* Button pulse animation */
@keyframes buttonPulse {
    0% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(40, 167, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
}

.btn-add-to-cart.pulse {
    animation: buttonPulse 0.8s ease;
}

/* Loading spinner for cart operations */
.cart-loading {
    position: relative;
    pointer-events: none;
}

.cart-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    z-index: 3;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Floating notification */
.floating-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 9999;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.4s ease;
    max-width: 300px;
}

.floating-notification.show {
    transform: translateY(0);
    opacity: 1;
}

.floating-notification.hide {
    transform: translateY(100px);
    opacity: 0;
}

.floating-notification img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 8px;
}

.floating-notification-content {
    flex: 1;
}

.floating-notification-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    color: #333;
}

.floating-notification-message {
    font-size: 12px;
    color: #666;
}

.floating-notification-close {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.floating-notification-close:hover {
    background-color: #f8f9fa;
}

/* Stop event propagation for cart controls */
.cart-item button,
.qty-btn,
.remove-btn,
.toast-close,
.floating-notification-close {
    pointer-events: auto;
}

/* Animations */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Scrollbar Styling */
.cart-body::-webkit-scrollbar {
    width: 6px;
}

.cart-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.cart-body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.cart-body::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ===== FLOATING CART STYLES ===== */
/* Floating Cart Button */
.floating-cart-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #000000 0%, #333333 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    cursor: pointer;
    z-index: 999;
    transition: all 0.3s ease;
    border: 2px solid white;
}

.floating-cart-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
}

.floating-cart-btn .cart-icon-wrapper {
    position: relative;
    color: white;
    font-size: 24px;
}

.cart-count-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e8e 100%);
    color: white;
    font-size: 12px;
    font-weight: bold;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Floating Cart Panel */
.floating-cart-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 350px;
    height: 100vh;
    background: white;
    box-shadow: -5px 0 25px rgba(0,0,0,0.15);
    z-index: 1000;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.floating-cart-panel.open {
    right: 0;
}

.cart-panel-header {
    background: black;
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #333;
}

.cart-panel-header h5 {
    margin: 0;
    font-weight: 600;
}

.close-cart-panel {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.close-cart-panel:hover {
    background: rgba(255,255,255,0.1);
}

.cart-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
}

.cart-panel-footer {
    padding: 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.cart-summary {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
}

.summary-row:last-child {
    margin-bottom: 0;
    font-weight: 600;
    font-size: 16px;
    color: #333;
}

/* Cart item in floating panel */
.cart-panel-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: white;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.cart-panel-item img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    margin-right: 12px;
    border: 2px solid #f0f0f0;
}

.cart-panel-item-content {
    flex: 1;
}

.cart-panel-item-title {
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 4px;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cart-panel-item-price {
    font-weight: 600;
    color: #000;
    font-size: 14px;
}

.cart-panel-item-qty {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.cart-panel-item-qty button {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
}

.cart-panel-item-qty span {
    min-width: 30px;
    text-align: center;
    font-weight: 500;
}

/* Empty cart state */
.empty-cart-state {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.empty-cart-state i {
    font-size: 48px;
    color: #dee2e6;
    margin-bottom: 15px;
}

.empty-cart-state p {
    margin: 0;
    font-size: 16px;
}

/* Overlay */
.cart-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.cart-panel-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Scrollbar for cart panel */
.cart-panel-body::-webkit-scrollbar {
    width: 4px;
}

.cart-panel-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.cart-panel-body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.cart-panel-body::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Responsive */
@media (max-width: 768px) {
    .cart-dropdown {
        min-width: 320px !important;
        max-width: 320px;
        position: fixed;
        top: 80px;
        right: 10px;
    }
    
    .cart-item {
        padding: 12px;
    }
    
    .cart-item-image {
        width: 50px;
        height: 50px;
    }
    
    .cart-actions {
        grid-template-columns: 1fr;
    }
    
    .floating-notification {
        max-width: 280px;
        bottom: 10px;
        right: 10px;
    }
    
    /* Floating cart responsive */
    .floating-cart-btn {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
    }
    
    .floating-cart-panel {
        width: 100%;
        max-width: 350px;
    }
    
    .cart-panel-header {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .cart-dropdown {
        min-width: 280px !important;
        max-width: 280px;
    }
    
    .cart-item {
        padding: 10px;
    }
    
    .cart-item-image {
        width: 40px;
        height: 40px;
    }
    
    .quantity-controls {
        gap: 4px;
    }
    
    .qty-btn {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }
    
    .qty-display {
        min-width: 24px;
        font-size: 12px;
    }
    
    .remove-btn {
        font-size: 10px;
        padding: 2px 6px;
    }
    
    .floating-notification {
        max-width: 250px;
        padding: 12px;
    }
    
    .floating-notification img {
        width: 35px;
        height: 35px;
    }
    
    /* Floating cart mobile */
    .floating-cart-btn {
        bottom: 15px;
        right: 15px;
        width: 50px;
        height: 50px;
    }
    
    .floating-cart-btn .cart-icon-wrapper {
        font-size: 20px;
    }
    
    .cart-count-badge {
        min-width: 18px;
        height: 18px;
        font-size: 10px;
    }
    
    .floating-cart-panel {
        max-width: 320px;
    }
    
    .cart-panel-item {
        padding: 10px;
    }
    
    .cart-panel-item img {
        width: 45px;
        height: 45px;
    }
    
    .cart-panel-item-title {
        font-size: 13px;
    }
    
    .cart-panel-item-price {
        font-size: 13px;
    }
}