/**
 * Magecom Package
 *
 * NOTICE OF LICENSE
 *
 * This source file is a subject to the Magecom license
 * that is available through the world-wide-web at this URL:
 * https://magecom.net/license-agreement/
 *
 * @copyright Magecom, Inc. (https://www.magecom.net)
 * @license https://magecom.net/license-agreement
 */

/*
==========================================================================
1. MODAL BASE & OVERLAY
==========================================================================
*/

.magecom-ajaxcart-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
}

.magecom-ajaxcart-modal.active {
    display: block !important;
}

.ajaxcart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1;
}

/* Container - Popup Style */
.magecom-ajaxcart-modal.ajaxcart-popup .ajaxcart-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 2;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Container - Sidebar Style */
.magecom-ajaxcart-modal.ajaxcart-sidebar .ajaxcart-container {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    background: #fff;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
    z-index: 2;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

/*
==========================================================================
 2. HEADER
==========================================================================
*/

.ajaxcart-header {
    padding: 20px;
    border-bottom: 2px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.ajaxcart-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #333;
}

.ajaxcart-close {
    background: none;
    border: none;
    font-size: 32px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.ajaxcart-close:hover {
    color: #333;
}

/*
==========================================================================
3. CONTENT AREA
==========================================================================
*/

.ajaxcart-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    position: relative;
}

.ajaxcart-empty {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.ajaxcart-items-count {
    text-align: center;
    padding-bottom: 15px;
    margin-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.ajaxcart-items-count strong {
    font-size: 18px;
    color: #333;
    margin-right: 5px;
}

/*
==========================================================================
4. CART ITEMS LIST
==========================================================================
*/

.ajaxcart-items-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ajaxcart-item {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
    list-style: none;
}

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

.ajaxcart-item-image {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}

.ajaxcart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.ajaxcart-item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ajaxcart-item-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ajaxcart-item-name {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    color: #333;
    text-decoration: none;
    line-height: 1.4;
}

.ajaxcart-item-name:hover {
    color: #1979c3;
}

.ajaxcart-item-edit {
    font-size: 13px;
    color: #1979c3;
    text-decoration: none;
}

.ajaxcart-item-edit:hover {
    text-decoration: underline;
}

.ajaxcart-item-options {
    font-size: 13px;
    color: #666;
}

.ajaxcart-item-option {
    margin-bottom: 3px;
}

.ajaxcart-item-option .label {
    font-weight: 600;
}

/* Item Price & Quantity Row */
.ajaxcart-item-price-qty {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: auto;
}

.ajaxcart-item-price {
    font-size: 16px;
    font-weight: 700;
    color: #333;
}

/* Item Actions (Remove Button) */
.ajaxcart-item-actions {
    flex-shrink: 0;
}

.ajaxcart-item-remove {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 5px;
    font-size: 24px;
    line-height: 1;
    transition: color 0.2s;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ajaxcart-item-remove:hover {
    color: #e02b27;
}

/*
==========================================================================
5. QUANTITY CONTROLS
==========================================================================
*/

.ajaxcart-item-qty.qty-buttons {
    display: inline-flex;
    align-items: center;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
}

.qty-button {
    width: 32px;
    height: 32px;
    border: none;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
    transition: all 0.2s;
    color: #333;
}

.qty-buttons .qty-button:hover:not(:disabled) {
    background: #f5f5f5;
}

.qty-buttons .qty-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.qty-buttons .qty-decrement {
    border-right: 1px solid #ccc;
}

.qty-buttons .qty-increment {
    border-left: 1px solid #ccc;
}

.qty-buttons .qty-input {
    width: 55px;
    height: 32px;
    text-align: center;
    border: none;
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    -moz-appearance: textfield;
}

.ajaxcart-item-qty.qty-input-only {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ajaxcart-item-qty.qty-input-only .qty-input {
    width: 60px;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

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

.qty-input[readonly] {
    background: #fff;
    cursor: default;
}

/*
==========================================================================
6. TOTALS
==========================================================================
*/

.ajaxcart-totals {
    padding: 15px 0;
    margin: 15px 0;
}

.ajaxcart-totals-top {
    margin-top: 0;
    border-top: none;
}

.ajaxcart-totals-table {
    display: block;
    border-top: 1px solid #e0e0e0;
}

.ajaxcart-total-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 14px;
}

.ajaxcart-total-line .label {
    color: #666;
    font-weight: 400;
}

.ajaxcart-total-line .price {
    color: #333;
    font-weight: 500;
}

.ajaxcart-subtotal {
    font-size: 15px;
}

.ajaxcart-subtotal .label {
    color: #333;
    font-weight: 500;
}

.ajaxcart-discount .price {
    color: #d32f2f;
}

.ajaxcart-grand-total {
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
    font-size: 18px;
    border-bottom: 2px solid #e0e0e0;
}

.ajaxcart-grand-total .label,
.ajaxcart-grand-total .price {
    color: #333;
    font-weight: 700;
}

/*
==========================================================================
7. COUPON CODE
==========================================================================
*/

.ajaxcart-coupon {
    margin: 20px 0;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 4px;
}

.ajaxcart-coupon label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.ajaxcart-coupon-input-wrapper {
    display: flex;
    gap: 10px;
}

.ajaxcart-coupon-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.ajaxcart-coupon-input[readonly] {
    background: #f5f5f5;
    color: #333;
    cursor: default;
}

.ajaxcart-coupon-apply {
    padding: 10px 20px;
    white-space: nowrap;
}

.ajaxcart-coupon-cancel {
    white-space: nowrap;
    background: #fff;
    border: 1px solid #ccc;
    color: #333;
}

.ajaxcart-coupon-cancel:hover {
    background: #f5f5f5;
    border-color: #999;
}

.ajaxcart-coupon-message {
    margin-top: 10px;
    padding: 10px;
    border-radius: 4px;
    font-size: 14px;
}

.ajaxcart-coupon-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.ajaxcart-coupon-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/*
==========================================================================
8. CROSS-SELL PRODUCTS
==========================================================================
*/

.ajaxcart-crosssell {
    padding: 20px;
    border-top: 2px solid #e0e0e0;
    background: #f9f9f9;
}

.ajaxcart-crosssell-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.ajaxcart-crosssell-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.ajaxcart-crosssell-nav {
    display: flex;
    gap: 8px;
}

.slider-nav {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    padding: 0;
}

.slider-nav:hover:not(:disabled) {
    background: #1979c3;
    border-color: #1979c3;
    color: #fff;
    transform: scale(1.1);
}

.slider-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.ajaxcart-crosssell-list-wrapper {
    overflow: hidden;
    position: relative;
    margin: 0 -5px;
    padding: 0 5px;
}

.ajaxcart-crosssell-list {
    display: flex;
    gap: 15px;
    transition: transform 0.3s ease;
    scroll-behavior: smooth;
    padding-right: 15px;
}

.ajaxcart-crosssell-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 10px;
    text-align: center;
    transition: box-shadow 0.3s ease;
    flex: 0 0 180px;
    min-width: 180px;
}

.ajaxcart-crosssell-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.crosssell-image {
    margin-bottom: 10px;
}

.crosssell-image img {
    max-width: 100%;
    height: auto;
    display: block;
}

.crosssell-name {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
    text-decoration: none;
    min-height: 40px;
    line-height: 1.4;
}

.crosssell-name:hover {
    color: #1979c3;
}

.crosssell-price {
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: 600;
}

.crosssell-price .old-price {
    text-decoration: line-through;
    color: #999;
    font-size: 14px;
    margin-right: 5px;
}

.crosssell-price .special-price {
    color: #ff5501;
}

.crosssell-actions {
    margin-top: 10px;
}

.ajaxcart-crosssell-add {
    background: #1979c3;
    color: #fff;
    border: none;
    padding: 8px 15px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 3px;
    transition: background 0.3s ease;
    width: 100%;
}

.ajaxcart-crosssell-add:hover {
    background: #155f96;
}

.ajaxcart-crosssell-add:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ajaxcart-crosssell-add.added {
    background: #28a745;
}

.crosssell-actions .out-of-stock {
    color: #999;
    font-size: 13px;
    font-style: italic;
}

.crosssell-actions .btn-primary {
    display: inline-block;
    background: #1979c3;
    color: #fff;
    padding: 8px 15px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 3px;
    transition: background 0.3s ease;
    border: 1px solid #1979c3;
}

.crosssell-actions .btn-primary:hover {
    background: #155f96;
}

/*
==========================================================================
9. ACTION BUTTONS
==========================================================================
*/

.ajaxcart-actions {
    display: flex;
    gap: 10px;
}

.ajaxcart-actions .action {
    flex: 1;
    padding: 15px 20px;
    text-align: center;
    border-radius: 4px;
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s;
    display: inline-block;
    border: 1px solid #1979c3;
}

.ajaxcart-actions .action.viewcart {
    background: #fff;
    color: #1979c3;
}

.ajaxcart-actions .action.viewcart:hover {
    background: #f5f5f5;
}

.ajaxcart-actions .action.primary {
    background: #1979c3;
    color: #fff;
}

.ajaxcart-actions .action.primary:hover {
    background: #155f96;
    border-color: #155f96;
}

/*
==========================================================================
10. LOADER
==========================================================================
*/

.ajaxcart-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

/*
==========================================================================
11. GLOBAL STATES
==========================================================================
*/

body.magecom-ajaxcart-open {
    overflow: hidden;
}

/*
==========================================================================
12. RESPONSIVE - MOBILE
==========================================================================
*/

@media (max-width: 768px) {
    .ajaxcart-container {
        width: 100% !important;
        max-width: 100% !important;
        height: 100%;
        border-radius: 0 !important;
    }

    .magecom-ajaxcart-modal.ajaxcart-popup .ajaxcart-container {
        top: 0;
        left: 0;
        transform: none;
    }

    .ajaxcart-actions {
        flex-direction: column;
    }

    .ajaxcart-crosssell-item {
        flex: 0 0 150px;
        min-width: 150px;
    }

    .slider-nav {
        width: 28px;
        height: 28px;
        font-size: 18px;
    }

    .ajaxcart-crosssell-title {
        font-size: 16px;
    }
}
