/* ========================================
   Shopping Cart Styles - Restaurant Theme
   Modern Invoice Design
   ======================================== */

:root {
    --cart-primary: #ce1212;
    --cart-primary-dark: #a00f0f;
    --cart-text: #212529;
    --cart-text-light: #7f7f90;
    --cart-bg: #ffffff;
    --cart-surface: #f8f9fa;
    --cart-border: #e9ecef;
    --cart-success: #28a745;
    --cart-danger: #dc3545;
}

/* ========================================
   Floating Cart Button
   ======================================== */
.floating-cart-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 999999;
    transition: transform 0.3s ease;
}

.floating-cart-btn .btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cart-primary) 0%, #a00f0f 100%);
    border: 3px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: #fff;
    box-shadow: 0 8px 24px rgba(206, 18, 18, 0.5);
    position: relative;
    transition: all 0.3s ease;
}

.floating-cart-btn .btn:hover {
    background: linear-gradient(135deg, #a00f0f 0%, #ce1212 100%);
    transform: scale(1.12) translateY(-2px);
    box-shadow: 0 10px 30px rgba(206, 18, 18, 0.7);
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: linear-gradient(135deg, #ffc107 0%, #ffb300 100%);
    color: #000;
    min-width: 26px;
    height: 26px;
    border-radius: 13px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    font-family: 'Roboto', sans-serif;
    border: 3px solid #fff;
    box-shadow: 0 3px 10px rgba(255, 193, 7, 0.5);
    animation: badgePop 0.3s ease;
}

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

/* Pulse Animation */
.pulse-animation {
    animation: pulse 0.6s ease;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* Ensure cart button is always above scroll button */
.floating-cart-btn {
    pointer-events: auto;
}

.floating-cart-btn .btn {
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Add a subtle glow effect */
.floating-cart-btn .btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--cart-primary);
    transform: translate(-50%, -50%);
    z-index: -1;
    opacity: 0;
    transition: all 0.3s ease;
}

.floating-cart-btn .btn:hover::before {
    width: 120%;
    height: 120%;
    opacity: 0.3;
}

/* ========================================
   Cart Sidebar - Invoice Style
   ======================================== */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -500px;
    width: 480px;
    height: 100vh;
    background: #fff;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    transition: right 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cart-sidebar.open {
    right: 0;
}

/* ========================================
   Cart Header - Restaurant Branding
   ======================================== */
.cart-header {
    background: linear-gradient(135deg, #ce1212 0%, #ff4444 100%);
    color: #fff;
    padding: 25px 25px 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.cart-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.cart-header h4 {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    font-family: 'Amatic SC', sans-serif;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.cart-header h4 i {
    font-size: 32px;
}

.cart-header p {
    margin: 5px 0 0 0;
    font-size: 13px;
    opacity: 0.9;
    font-weight: 400;
}

.btn-close-cart {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.btn-close-cart:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* ========================================
   Cart Body - Invoice Items
   ======================================== */
.cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    background: var(--cart-surface);
}

.cart-body::-webkit-scrollbar {
    width: 8px;
}

.cart-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.cart-body::-webkit-scrollbar-thumb {
    background: var(--cart-primary);
    border-radius: 4px;
}

/* Empty Cart State */
.empty-cart {
    padding: 60px 30px;
    text-align: center;
}

.empty-cart i {
    font-size: 80px;
    color: #dee2e6;
    margin-bottom: 20px;
    display: block;
}

.empty-cart p {
    color: var(--cart-text-light);
    font-size: 16px;
    margin-bottom: 25px;
}

.empty-cart .btn {
    background: var(--cart-primary);
    color: #fff;
    padding: 12px 30px;
    border-radius: 50px;
    border: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.empty-cart .btn:hover {
    background: var(--cart-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(206, 18, 18, 0.3);
}

/* ========================================
   Cart Items - Invoice Style
   ======================================== */
.cart-items-wrapper {
    padding: 20px;
}

.cart-invoice-header {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.cart-invoice-header h5 {
    margin: 0 0 5px 0;
    font-family: 'Amatic SC', sans-serif;
    font-size: 24px;
    color: var(--cart-text);
}

.cart-invoice-header p {
    margin: 0;
    font-size: 13px;
    color: var(--cart-text-light);
}

.cart-item {
    background: #fff;
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    border-left: 4px solid var(--cart-primary);
}

.cart-item:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transform: translateX(-3px);
}

.cart-item-content {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.cart-item-image {
    width: 70px;
    height: 70px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: var(--cart-surface);
}

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

.cart-item-details {
    flex: 1;
}

.cart-item-details h6 {
    margin: 0 0 6px 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--cart-text);
    font-family: 'Roboto', sans-serif;
}

.cart-item-price-tag {
    font-size: 14px;
    color: var(--cart-text-light);
    margin-bottom: 10px;
}

.cart-item-price-tag .price-amount {
    font-weight: 600;
    color: var(--cart-primary);
}

/* Quantity Controls */
.quantity-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--cart-surface);
    padding: 4px 8px;
    border-radius: 25px;
    display: inline-flex;
}

.quantity-controls button {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--cart-primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 700;
}

.quantity-controls button:hover {
    background: var(--cart-primary-dark);
    transform: scale(1.1);
}

.quantity-controls button:active {
    transform: scale(0.95);
}

.quantity-controls span {
    min-width: 35px;
    text-align: center;
    font-weight: 700;
    color: var(--cart-text);
    font-size: 15px;
}

.cart-item-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.cart-item-subtotal {
    font-size: 18px;
    font-weight: 700;
    color: var(--cart-primary);
    font-family: 'Roboto', sans-serif;
}

.btn-remove-item {
    background: transparent;
    border: none;
    color: var(--cart-danger);
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    transition: all 0.3s ease;
    opacity: 0.7;
}

.btn-remove-item:hover {
    opacity: 1;
    transform: scale(1.2);
}

/* ========================================
   Cart Footer - Invoice Total
   ======================================== */
.cart-footer {
    background: #fff;
    padding: 20px 25px;
    border-top: 3px solid var(--cart-surface);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
}

.cart-summary {
    background: var(--cart-surface);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 18px;
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 15px;
    color: var(--cart-text);
}

.cart-summary-row:last-child {
    margin-bottom: 0;
    padding-top: 12px;
    border-top: 2px dashed var(--cart-border);
}

.cart-summary-row.total {
    font-size: 20px;
    font-weight: 700;
    color: var(--cart-text);
}

.cart-summary-row .value {
    font-weight: 600;
}

.cart-summary-row.total .value {
    color: var(--cart-success);
    font-size: 24px;
}

/* Cart Action Buttons */
.cart-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cart-actions .btn {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 16px;
    font-family: 'Roboto', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cart-actions .btn i {
    font-size: 20px;
}

.btn-whatsapp-order {
    background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3);
}

.btn-whatsapp-order:hover {
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5);
    transform: translateY(-2px);
}

.btn-clear-cart {
    background: transparent;
    color: var(--cart-danger);
    border: 2px solid var(--cart-danger);
}

.btn-clear-cart:hover {
    background: var(--cart-danger);
    color: #fff;
    transform: translateY(-2px);
}

/* ========================================
   Cart Overlay
   ======================================== */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

/* ========================================
   Add to Cart Button - Menu Items
   ======================================== */
.menu-item {
    position: relative;
}

.add-to-cart-btn {
    width: 100%;
    padding: 8px 16px;
    background: var(--cart-primary);
    color: #fff;
    border: none;
    border-radius: 5px;
    font-weight: 600;
    font-size: 14px;
    font-family: 'Roboto', sans-serif;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(206, 18, 18, 0.2);
}

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

.add-to-cart-btn:hover {
    background: var(--cart-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(206, 18, 18, 0.4);
}

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

.add-to-cart-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Success State */
.add-to-cart-btn.btn-success {
    background: var(--cart-success);
    animation: successPulse 0.6s ease;
}

@keyframes successPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 992px) {
    .cart-sidebar {
        width: 400px;
        right: -400px;
    }
}

@media (max-width: 768px) {
    .cart-sidebar {
        width: 100%;
        right: -100%;
        max-width: 100%;
    }
    
    .floating-cart-btn {
        bottom: 80px;
        right: 15px;
        z-index: 999999;
    }
    
    .floating-cart-btn .btn {
        width: 55px;
        height: 55px;
        font-size: 22px;
    }
    
    .cart-badge {
        min-width: 22px;
        height: 22px;
        font-size: 11px;
        top: -5px;
        right: -5px;
    }
    
    .cart-header {
        padding: 20px 15px 15px;
    }
    
    .cart-header h4 {
        font-size: 22px;
    }
    
    .cart-items-wrapper {
        padding: 15px;
    }
    
    .cart-item {
        padding: 12px;
    }
    
    .cart-item-image {
        width: 60px;
        height: 60px;
    }
    
    .cart-item-details h6 {
        font-size: 14px;
    }
    
    .cart-footer {
        padding: 15px;
    }
    
    .add-to-cart-btn {
        font-size: 13px;
        padding: 7px 14px;
    }
}

@media (max-width: 576px) {
    .floating-cart-btn {
        bottom: 75px;
        right: 12px;
    }
    
    .floating-cart-btn .btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .cart-badge {
        min-width: 20px;
        height: 20px;
        font-size: 10px;
    }
    
    .cart-header h4 {
        font-size: 20px;
    }
    
    .cart-header p {
        font-size: 11px;
    }
    
    .btn-close-cart {
        width: 35px;
        height: 35px;
        font-size: 18px;
    }
    
    .cart-item-content {
        flex-wrap: wrap;
    }
    
    .cart-item-image {
        width: 55px;
        height: 55px;
    }
    
    .cart-item-details {
        flex: 1;
        min-width: 0;
    }
    
    .cart-item-details h6 {
        font-size: 13px;
        margin-bottom: 4px;
    }
    
    .cart-item-price-tag {
        font-size: 12px;
    }
    
    .cart-item-actions {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
        margin-top: 8px;
    }
    
    .cart-item-subtotal {
        font-size: 16px;
    }
    
    .quantity-controls button {
        width: 26px;
        height: 26px;
        font-size: 12px;
    }
    
    .quantity-controls span {
        min-width: 28px;
        font-size: 14px;
    }
    
    .cart-summary {
        padding: 15px;
    }
    
    .cart-summary-row {
        font-size: 14px;
    }
    
    .cart-summary-row.total {
        font-size: 18px;
    }
    
    .cart-summary-row.total .value {
        font-size: 20px;
    }
    
    .cart-actions .btn {
        padding: 12px;
        font-size: 14px;
    }
    
    .add-to-cart-btn {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .add-to-cart-btn i {
        font-size: 14px;
    }
}

/* ========================================
   Loading & Animation States
   ======================================== */
.loading-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Fade In Animation for Cart Items */
.cart-item {
    animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   Dark Mode for Shopping Cart
   ======================================== */
body.dark-mode .cart-sidebar {
    background: #1a1a1a;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.5);
}

body.dark-mode .cart-header {
    background: linear-gradient(135deg, #d62828 0%, #b71c1c 100%);
}

body.dark-mode .cart-body {
    background: #0f0f0f;
}

body.dark-mode .cart-body::-webkit-scrollbar-track {
    background: #1a1a1a;
}

body.dark-mode .cart-body::-webkit-scrollbar-thumb {
    background: #d62828;
}

body.dark-mode .empty-cart i {
    color: #3a3a3a;
}

body.dark-mode .empty-cart p {
    color: #b8b8b8;
}

body.dark-mode .cart-items-wrapper {
    background: #0f0f0f;
}

body.dark-mode .cart-invoice-header {
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

body.dark-mode .cart-invoice-header h5 {
    color: #ffffff;
}

body.dark-mode .cart-invoice-header p {
    color: #b8b8b8;
}

body.dark-mode .cart-item {
    background: #1a1a1a;
    border-left-color: #d62828;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

body.dark-mode .cart-item:hover {
    background: #202020;
    box-shadow: 0 4px 15px rgba(214, 40, 40, 0.2);
}

body.dark-mode .cart-item-image {
    background: #0f0f0f;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

body.dark-mode .cart-item-details h6 {
    color: #ffffff;
}

body.dark-mode .cart-item-price-tag {
    color: #b8b8b8;
}

body.dark-mode .cart-item-price-tag .price-amount {
    color: #d62828;
}

body.dark-mode .quantity-controls {
    background: #0f0f0f;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

body.dark-mode .quantity-controls button {
    background: #d62828;
}

body.dark-mode .quantity-controls button:hover {
    background: #b71c1c;
}

body.dark-mode .quantity-controls span {
    color: #ffffff;
}

body.dark-mode .cart-item-subtotal {
    color: #d62828;
}

body.dark-mode .cart-footer {
    background: #1a1a1a;
    border-top-color: #2a2a2a;
}

body.dark-mode .cart-summary {
    background: #0f0f0f;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

body.dark-mode .cart-summary-row {
    color: #e8e8e8;
}

body.dark-mode .cart-summary-row:last-child {
    border-top-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .cart-summary-row.total {
    color: #ffffff;
}

body.dark-mode .cart-summary-row.total .value {
    color: #28a745;
}

body.dark-mode .btn-whatsapp-order {
    background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
}

body.dark-mode .btn-clear-cart {
    color: #ff6b6b;
    border-color: #ff6b6b;
}

body.dark-mode .btn-clear-cart:hover {
    background: #ff6b6b;
    color: #ffffff;
}

body.dark-mode .cart-overlay {
    background: rgba(0, 0, 0, 0.85);
}
