/**
 * Shopping Cart UI Styling
 * Floating cart icon and drawer styles
 */

/* Cart Icon - Floating Button */
#cartIcon {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    z-index: 998;
    outline: none;
}

#cartIcon:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

#cartIcon:active {
    transform: scale(0.95);
}

/* Cart Count Badge */
#cartCount {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff6b6b;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.4);
    animation: badgePulse 0.5s ease;
}

@keyframes badgePulse {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Cart Drawer - Overlay */
#cartDrawer {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 999;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#cartDrawer.open {
    right: 0;
}

/* Cart Drawer Header */
.cart-drawer-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.cart-drawer-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
}

.cart-drawer-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #95a5a6;
    transition: color 0.2s ease;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-drawer-close:hover {
    color: #2c3e50;
}

/* Cart Items Container */
.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Empty Cart State */
.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #95a5a6;
    text-align: center;
}

.cart-empty i {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.cart-empty p {
    margin: 10px 0;
    font-size: 14px;
}

.cart-empty p:first-of-type {
    font-weight: 600;
    color: #2c3e50;
}

/* Cart Item */
.cart-item {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
}

.cart-item:hover {
    background: #f0f1f3;
    border-color: #667eea;
}

.cart-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    gap: 12px;
}

.cart-item-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    flex: 1;
    word-break: break-word;
}

.btn-remove {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    font-size: 14px;
    padding: 4px 8px;
    transition: color 0.2s ease;
    flex-shrink: 0;
}

.btn-remove:hover {
    color: #c0392b;
}

/* Cart Item Controls */
.cart-item-controls {
    margin-bottom: 12px;
}

.cart-item-controls label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #7f8c8d;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group {
    display: flex;
    align-items: center;
}

.input-addon {
    background: white;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
    font-weight: 600;
    color: #2c3e50;
}

.input-group .form-control {
    border-radius: 0 4px 4px 0;
    border: 1px solid #ddd;
    padding: 8px 12px;
    font-size: 14px;
}

.input-group .form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

/* Quantity Control */
.quantity-control {
    display: flex;
    align-items: center;
    gap: 4px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 4px;
}

.btn-qty {
    background: none;
    border: none;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 16px;
    color: #667eea;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    border-radius: 3px;
}

.btn-qty:hover {
    background: #f0f1f3;
}

.qty-input {
    width: 50px;
    border: none;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
}

.qty-input:focus {
    outline: none;
}

.price-per-item {
    display: block;
    font-size: 12px;
    color: #7f8c8d;
    margin-top: 4px;
}

/* Cart Item Total */
.cart-item-total {
    font-size: 16px;
    font-weight: 700;
    color: #667eea;
    text-align: right;
    padding-top: 12px;
    border-top: 1px solid #e9ecef;
}

/* Cart Summary */
.cart-summary {
    padding: 20px;
    border-top: 2px solid #e9ecef;
    background: #f8f9fa;
    flex-shrink: 0;
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: #7f8c8d;
    margin-bottom: 12px;
}

.cart-summary-row span:last-child {
    font-weight: 600;
    color: #2c3e50;
}

.cart-summary-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 18px;
    font-weight: 700;
    color: #2c3e50;
    padding-top: 12px;
    border-top: 1px solid #e9ecef;
}

.total-amount {
    color: #667eea;
    font-size: 22px;
}

/* Cart Actions */
.cart-actions {
    padding: 20px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-shrink: 0;
}

.btn-checkout {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-checkout:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-checkout:active {
    transform: translateY(0);
}

.btn-clear {
    background: #ecf0f1;
    color: #7f8c8d;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-clear:hover {
    background: #dfe6e9;
    color: #2c3e50;
}

/* Notifications */
.cart-notification {
    animation: slideIn 0.3s ease;
    border-left: 4px solid;
}

.notification-success {
    border-left-color: #27ae60;
}

.notification-error {
    border-left-color: #e74c3c;
}

.notification-info {
    border-left-color: #3498db;
}

/* Scrollbar Styling for Cart Items */
.cart-items::-webkit-scrollbar {
    width: 6px;
}

.cart-items::-webkit-scrollbar-track {
    background: transparent;
}

.cart-items::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

.cart-items::-webkit-scrollbar-thumb:hover {
    background: #ccc;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    #cartIcon {
        width: 56px;
        height: 56px;
        bottom: 20px;
        right: 20px;
        font-size: 24px;
    }

    #cartDrawer {
        width: 100%;
        right: -100%;
    }

    .cart-drawer-header h3 {
        font-size: 18px;
    }

    .cart-item-header h4 {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    #cartIcon {
        width: 52px;
        height: 52px;
        bottom: 16px;
        right: 16px;
    }

    #cartCount {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }

    #cartDrawer {
        box-shadow: none;
        background: white;
    }

    .cart-items {
        padding: 16px;
        gap: 12px;
    }

    .cart-item {
        padding: 12px;
        border-radius: 6px;
    }

    .quantity-control {
        font-size: 12px;
    }

    .qty-input {
        width: 40px;
    }

    .btn-qty {
        width: 24px;
        height: 24px;
    }
}

/* Loading State */
#cartIcon.loading {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Button Utilities */
.btn {
    display: inline-block;
    padding: 10px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
    text-align: center;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #ecf0f1;
    color: #7f8c8d;
}

.btn-secondary:hover {
    background: #dfe6e9;
    color: #2c3e50;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

/* Add to Cart Button - To be used on product pages */
.btn-add-to-cart {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-add-to-cart:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-add-to-cart:active {
    transform: translateY(0);
}

.btn-add-to-cart i {
    font-size: 16px;
}
