/**
 * Shopping Cart System Styles
 * Hover overlays and persistent cart panel
 */

/* Product Hover Overlay */
.product-hover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 10;
    border-radius: 4px;
}

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

.overlay-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    max-width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.product-hover-overlay.show .overlay-content {
    transform: translateY(0);
}

.product-info {
    margin-bottom: 15px;
}

.product-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    line-height: 1.3;
}

.product-price-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.old-price {
    text-decoration: line-through;
    color: #999;
    font-size: 12px;
}

.current-price {
    font-weight: 600;
    color: #d1223e;
    font-size: 16px;
}

.quantity-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

.qty-btn {
    width: 30px;
    height: 30px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.qty-btn:hover {
    background: #f5f5f5;
    border-color: #d1223e;
}

.qty-display {
    min-width: 30px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
}

.add-to-bag-btn {
    background: #d1223e;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: center;
    transition: all 0.2s ease;
}

.add-to-bag-btn:hover {
    background: #b01e35;
    transform: translateY(-1px);
}

.add-to-bag-btn i {
    font-size: 14px;
}

/* Added to cart animation */
.product-default.added-to-cart,
.ajaxplist.added-to-cart {
    animation: addedToCart 2s ease;
}

@keyframes addedToCart {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
        background: #d4edda;
    }

    100% {
        transform: scale(1);
    }
}

/* Persistent Cart Panel */
.persistent-cart-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.persistent-cart-panel.open {
    right: 0;
}

.cart-panel-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8f9fa;
}

.cart-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cart-header-info i {
    font-size: 20px;
    color: #d1223e;
}

.cart-item-count {
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.cart-close-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.cart-close-btn:hover {
    background: #f0f0f0;
    color: #333;
}

.cart-panel-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.delivery-info {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.delivery-banner {
    background: #d4edda;
    color: #155724;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.express-delivery {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #666;
}

.express-delivery i {
    color: #d1223e;
}

.cart-items-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
}

.item-quantity-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 80px;
}

.item-quantity-controls .qty-btn {
    width: 25px;
    height: 25px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.item-quantity-controls .qty-btn:hover {
    background: #f5f5f5;
    border-color: #d1223e;
}

.item-quantity-controls .item-quantity {
    min-width: 20px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
}

.cart-item:last-child {
    border-bottom: none;
}

.item-quantity {
    background: #d1223e;
    color: white;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.item-image {
    width: 50px;
    height: 50px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

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

.item-details {
    flex: 1;
}

.item-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    color: #333;
    line-height: 1.3;
}

.item-price {
    font-weight: 600;
    color: #d1223e;
    font-size: 14px;
}

.item-weight {
    font-size: 12px;
    color: #666;
    text-decoration: line-through;
}

.item-remove {
    position: absolute;
    top: 10px;
    right: 0;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.item-remove:hover {
    background: #f0f0f0;
    color: #d1223e;
}

.empty-cart {
    text-align: center;
    color: #666;
    padding: 40px 20px;
    font-style: italic;
}

.cart-panel-footer {
    border-top: 1px solid #eee;
    padding: 20px;
    background: #f8f9fa;
}

.special-code-section {
    margin-bottom: 15px;
}

.special-code-toggle {
    background: none;
    border: none;
    color: #d1223e;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 0;
    text-align: left;
}

.special-code-toggle:hover {
    text-decoration: underline;
}

.special-code-input {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.special-code-input input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.special-code-input button {
    padding: 8px 16px;
    background: #d1223e;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
}

.place-order-section {
    margin-top: 15px;
}

.place-order-btn {
    width: 100%;
    background: #d1223e;
    color: white;
    border: none;
    padding: 15px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
}

.place-order-btn:hover {
    background: #b01e35;
    transform: translateY(-1px);
}

.order-total {
    font-size: 18px;
    font-weight: 700;
}

/* Responsive Design */
@media (max-width: 768px) {
    .persistent-cart-panel {
        width: 100%;
        right: -100%;
    }

    .overlay-content {
        padding: 15px;
        max-width: 95%;
    }

    .product-name {
        font-size: 13px;
    }

    .current-price {
        font-size: 14px;
    }

    .add-to-bag-btn {
        padding: 8px 16px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .cart-item {
        gap: 10px;
        padding: 12px 0;
    }

    .item-image {
        width: 40px;
        height: 40px;
    }

    .item-name {
        font-size: 13px;
    }

    .item-price {
        font-size: 13px;
    }
}

/* Confirmation / receipt styles */
.order_d_inner {
    display: flex;
    gap: 30px;
    align-items: stretch;
}

.order_d_inner .details_item h5 {
    margin-bottom: 10px;
}

.details_item {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.download-receipt-btn {
    display: inline-block;
    color: #2c7a2c;
    margin-top: 8px;
    font-weight: 600;
}

.order_details_table .table td,
.order_details_table .table th {
    vertical-align: middle;
}

.order_details_table .table tfoot td {
    font-weight: 700;
}

@media (max-width: 992px) {
    .order_d_inner {
        flex-direction: column;
        gap: 15px;
    }
}

/* Animation for cart panel slide in */
@keyframes slideInRight {
    from {
        right: -400px;
    }

    to {
        right: 0;
    }
}

@keyframes slideOutRight {
    from {
        right: 0;
    }

    to {
        right: -400px;
    }
}

/* Smooth transitions for cart updates */
.cart-item {
    animation: slideInUp 0.3s ease;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading state for cart operations */
.cart-loading {
    opacity: 0.6;
    pointer-events: none;
}

.cart-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #d1223e;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Toast animations */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Floating Cart Button */
.floating-cart-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #d1223e;
    color: white;
    padding: 15px 20px;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(209, 34, 62, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 999;
    transition: all 0.3s ease;
    min-width: 120px;
}

.floating-cart-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(209, 34, 62, 0.4);
    background: #b01e35;
}

.floating-cart-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.floating-cart-icon i {
    font-size: 20px;
}

.floating-cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #fff;
    color: #d1223e;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    border: 2px solid #d1223e;
}

.floating-cart-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.floating-cart-label {
    font-size: 12px;
    opacity: 0.9;
    line-height: 1;
}

.floating-cart-total {
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
}

/* Responsive floating cart */
@media (max-width: 768px) {
    .floating-cart-button {
        bottom: 20px;
        right: 20px;
        padding: 12px 16px;
        min-width: 100px;
    }

    .floating-cart-icon i {
        font-size: 18px;
    }

    .floating-cart-total {
        font-size: 14px;
    }
}

/* Layout adjustment when cart panel is open */
body.cart-panel-open .main-content,
body.cart-panel-open main.main,
body.cart-panel-open .container {
    transition: margin-right 0.3s ease, max-width 0.3s ease;
}

/* Desktop: Reduce content width when cart is open */
@media (min-width: 769px) {
    body.cart-panel-open .main-content {
        margin-right: 400px;
    }

    body.cart-panel-open main.main .container {
        max-width: calc(100vw - 400px - var(--left-menu-width, 250px));
    }
}

/* Tablet and smaller: Cart takes full width, so no adjustment needed */
@media (max-width: 768px) {

    body.cart-panel-open .main-content,
    body.cart-panel-open main.main .container {
        margin-right: 0;
        max-width: 100%;
    }
}