/* Cart Badge Styles */
.cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    min-width: 20px;
    height: 20px;
    line-height: 20px;
    padding: 0 6px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    background-color: #ff4d4f;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: scale(1);
    opacity: 1;
}

.cart-badge.cart-updated {
    animation: cartPulse 0.6s ease-in-out;
}

@keyframes cartPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* Remove duplicate notification styles - Moved to style.css */

/* Button States */
.add-to-cart-btn {
    position: relative;
    transition: all 0.3s ease;
    overflow: hidden;
}

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

.add-to-cart-btn.added-to-cart {
    background-color: #52c41a !important;
    border-color: #52c41a !important;
    color: white !important;
}

/* Loading Spinner */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spinner-border {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    vertical-align: text-bottom;
    border: 0.2em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    margin-right: 0.5rem;
}

/* Cart Dropdown */
.cart-dropdown {
    min-width: 300px;
    max-height: 400px;
    overflow-y: auto;
    padding: 0;
}

.cart-item {
    display: flex;
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.cart-item:hover {
    background-color: #f9f9f9;
}

.cart-item-img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    margin-right: 12px;
    border-radius: 4px;
}

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

.cart-item-title {
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-price {
    font-weight: 600;
    color: #1890ff;
}

.cart-item-quantity {
    font-size: 0.9em;
    color: #666;
}

.cart-footer {
    padding: 12px;
    border-top: 1px solid #f0f0f0;
    background-color: #fafafa;
}

/* Cart item styles */
.cart-item.item-excluded {
    opacity: 0.6;
    background-color: #f8f9fa;
    transition: opacity 0.3s ease, background-color 0.3s ease;
}

.cart-item.item-excluded .item-total,
.cart-item.item-excluded .item-price {
    text-decoration: line-through;
    color: #6c757d;
}

.cart-item.item-excluded .item-total {
    text-decoration: line-through;
    color: #6c757d;
}

/* Loading spinner */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spinner-border {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    vertical-align: text-bottom;
    border: 0.2em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Checkbox Styling */
.item-include-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin-right: 10px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .item-include-checkbox {
        width: 20px;
        height: 20px;
    }
}

/* Empty Cart State */
.empty-cart {
    padding: 24px;
    text-align: center;
    color: #999;
}

.empty-cart i {
    font-size: 48px;
    margin-bottom: 12px;
    display: block;
    color: #d9d9d9;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .cart-badge {
        top: -5px;
        right: -5px;
        min-width: 18px;
        height: 18px;
        line-height: 18px;
        font-size: 10px;
    }
}

/* Mobile and Tablet Styles */
@media (max-width: 991.98px) {
    .cart-item {
        background-color: #fffde7; /* Light yellow background */
        border-radius: 8px;
        margin-bottom: 15px;
        padding: 15px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }

    .cart-item:last-child {
        margin-bottom: 0;
    }

    /* Adjust table cells for better mobile display */
    .cart-item td {
        padding: 8px 5px;
    }

    /* Make sure the yellow background is visible on all cells */
    .cart-item td:first-child {
        border-top-left-radius: 8px;
        border-bottom-left-radius: 8px;
    }

    .cart-item td:last-child {
        border-top-right-radius: 8px;
        border-bottom-right-radius: 8px;
    }
}

/* For very small screens (phones) */
@media (max-width: 575.98px) {
    .cart-item {
        padding: 12px 10px;
    }

    /* Make product image smaller on mobile */
    .cart-item img {
        max-width: 60px;
        height: auto;
    }
}

/* For very small screens (375px and below) */
@media (max-width: 375px) {
    /* Adjust cart item layout */
    .cart-item {
        padding: 10px 5px !important;
        position: relative;
    }

    /* Position delete button */
    .cart-item .btn-danger {
        position: absolute !important;
        right: 5px !important;
        top: 5px !important;
        padding: 4px 6px !important;
        font-size: 12px !important;
        min-width: auto !important;
        width: 24px !important;
        height: 24px !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    /* Position checkbox */
    .cart-item .form-check {
        position: absolute !important;
        right: 35px !important;
        top: 8px !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Adjust product info spacing */
    .cart-item > td:nth-child(2) {
        padding-right: 80px !important;
        min-height: 50px;
    }

    /* Adjust quantity controls */
    .quantity-selector {
        margin: 0 auto;
        transform: scale(0.85);
    }

    /* Ensure price/quantity/total row takes full width */
    .cart-item > td:nth-child(3),
    .cart-item > td:nth-child(4),
    .cart-item > td:nth-child(5) {
        padding: 2px 0 !important;
        font-size: 12px !important;
    }

    /* Make sure product image doesn't take too much space */
    .cart-item img {
        max-width: 40px !important;
        height: 40px !important;
    }
}

/* Desktop styles (min-width: 992px) */
@media (min-width: 992px) {
    /* Reset any flex display on table rows for desktop */
    .table tbody tr.cart-item {
        display: table-row !important;
    }

    /* Ensure table cells maintain their layout */
    .table {
        table-layout: fixed;
        width: 100% !important;
    }

    /* Column widths */
    .table th:nth-child(1),
    .table td:nth-child(1) {
        width: 60px !important;  /* Checkbox column */
        min-width: 60px;
        max-width: 60px;
        text-align: center !important;
    }

    .table th:nth-child(2),
    .table td:nth-child(2) {
        width: auto !important;  /* Product name column */
        min-width: 200px;
        padding-right: 15px !important;
        text-align: left !important;
    }

    .table th:nth-child(3),
    .table td:nth-child(3) {
        width: 120px !important;  /* Price column */
        min-width: 120px;
        max-width: 120px;
        text-align: right !important;
        padding-right: 20px !important;
        white-space: nowrap;
    }

    .table th:nth-child(4),
    .table td:nth-child(4) {
        width: 150px !important;  /* Quantity column */
        min-width: 150px;
        max-width: 150px;
        text-align: center !important;
        padding: 0 10px !important;
    }

    .table th:nth-child(5),
    .table td:nth-child(5) {
        width: 120px !important;  /* Total column */
        min-width: 120px;
        max-width: 120px;
        text-align: right !important;
        padding-right: 20px !important;
        white-space: nowrap;
    }

    .table th:nth-child(6),
    .table td:nth-child(6) {
        width: 60px !important;  /* Actions column */
        min-width: 60px;
        max-width: 60px;
        text-align: center !important;
        padding: 0 5px !important;
    }

    /* Quantity controls */
    .quantity-control {
        display: flex;
        justify-content: center;
        align-items: center;
        margin: 0 auto;
        max-width: 120px;
    }

    .quantity-btn {
        width: 30px;
        height: 30px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 1px solid #dee2e6;
        background: #f8f9fa;
    }

    .quantity-input {
        width: 40px;
        text-align: center;
        margin: 0 5px;
        padding: 0.25rem;
    }

    /* Ensure proper vertical alignment */
    .table td {
        vertical-align: middle !important;
    }

    /* Override any conflicting styles */
    .table td,
    .table th {
        display: table-cell !important;
        float: none !important;
    }
}

/* Cart Page Specific Styles */
.cart-table {
    width: 100%;
    margin-bottom: 1rem;
    background-color: transparent;
    border-collapse: collapse;
}

.cart-table th,
.cart-table td {
    padding: 0.75rem;
    vertical-align: middle;
    border-top: 1px solid #e9ecef;
}

.cart-table thead th {
    vertical-align: bottom;
    border-bottom: 2px solid #e9ecef;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    color: #6c757d;
}

.quantity-selector {
    display: inline-flex;
    align-items: center;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    overflow: hidden;
}

.quantity-btn {
    background: #f8f9fa;
    border: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.quantity-btn:hover {
    background: #e9ecef;
}

.quantity-input {
    width: 50px;
    height: 32px;
    text-align: center;
    border: none;
    border-left: 1px solid #d9d9d9;
    border-right: 1px solid #d9d9d9;
    -moz-appearance: textfield;
}

.quantity-input::-webkit-outer-spin-button,
.quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Checkout Button Styles */
.btn-checkout {
    background: linear-gradient(135deg, #52c41a 0%, #389e0d 100%);
    border: none;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 12px 24px;
    border-radius: 6px;
    box-shadow: 0 4px 15px rgba(82, 196, 26, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.btn-checkout:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(82, 196, 26, 0.4);
    background: linear-gradient(135deg, #5cd223 0%, #42b30f 100%);
}

.btn-checkout:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(82, 196, 26, 0.3);
}

.btn-checkout i {
    margin-right: 8px;
    font-size: 1.2em;
}

/* Secondary Buttons */
.btn-outline-secondary {
    border-width: 2px;
    font-weight: 500;
    transition: all 0.2s ease;
}

#clear-cart-btn {
    border-width: 2px;
    font-weight: 500;
    transition: all 0.2s ease;
}

#clear-cart-btn:hover {
    background-color: #fff1f0;
    border-color: #ff4d4f;
    color: #ff4d4f;
}
