/* Utility Classes */
.is-hidden {
    display: none !important;
}

/* Cart Modal Styling */
.novateplica-cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.novateplica-cart-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

/* Prevent Background Scroll when Modals/Menus are Open */
html.no-scroll,
body.no-scroll {
    overflow: hidden;
    height: 100%;
    width: 100%;
    position: fixed;
}

/* Empty State */
.cart-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    width: 100%;
}

.cart-empty-icon {
    font-size: 64px;
    color: #e9e9e9;
    margin-bottom: 24px;
}

.cart-empty-state p {
    font-size: 20px;
    color: #221f1f;
    margin-bottom: 32px;
}

/* Icons in buttons */
.cart-checkout-btn i,
.cart-continue-btn i {
    margin-right: 8px;
}

.cart-checkout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Adjust Empty Button */
.cart-empty-state .cart-continue-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #00a046;
    color: #fff;
    padding: 12px 24px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
}

.cart-empty-state .cart-continue-btn:hover {
    background-color: #008a3c;
}

.novateplica-cart-modal {
    background: #fff;
    width: 960px;
    max-width: 95%;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.novateplica-cart-overlay.is-open .novateplica-cart-modal {
    transform: translateY(0);
}

.novateplica-cart-modal-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.cart-modal-header {
    padding: 24px;
    border-bottom: 1px solid #e9e9e9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-modal-title {
    font-size: 24px;
    font-weight: 700;
    color: #221f1f;
    margin: 0;
}

.cart-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #a6a5a5;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: color 0.2s;
}

.cart-modal-close:hover {
    color: #221f1f;
}

.cart-modal-body {
    padding: 0;
    overflow-y: auto;
    flex-grow: 1;
    min-height: 0;
    /* Critical for flex scrolling */
}

/* Custom Scrollbar for better visibility */
.cart-modal-body::-webkit-scrollbar {
    width: 6px;
}

.cart-modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.cart-modal-body::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.cart-modal-body::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.cart-controls-bar {
    padding: 16px 24px;
    border-bottom: 1px solid #e9e9e9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.cart-select-all {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.cart-select-all input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #00a046;
    cursor: pointer;
}

.cart-action-icons {
    display: flex;
    gap: 16px;
}

.cart-icon-btn {
    color: #3e77aa;
    cursor: pointer;
    font-size: 18px;
}

.cart-icon-btn:hover {
    color: #f84147;
}

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

.cart-item {
    padding: 24px;
    border-bottom: 1px solid #e9e9e9;
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

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

/* Selection Checkboxes - Always visible but stylish */
.cart-item-checkbox {
    width: 30px;
    opacity: 1;
    /* Always visible */
    padding-top: 5px;
    /* Better alignment for centered layout */
    margin-right: 15px;
    display: flex;
    align-items: center;
}

.cart-item-checkbox input {
    width: 18px;
    height: 18px;
    accent-color: #00a046;
    cursor: pointer;
    border: 1px solid #d2d2d2;
    border-radius: 4px;
}

.cart-item-image-wrapper {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 4px;
}

.cart-item-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    max-width: 80px;
}

.cart-item-info {
    flex-grow: 1;
}

.cart-item-title {
    font-size: 16px;
    line-height: 1.4;
    color: #221f1f;
    text-decoration: none;
    display: block;
    margin-bottom: 8px;
}

.cart-item-title:hover {
    color: #f84147;
    text-decoration: underline;
}

.cart-item-meta {
    font-size: 13px;
    color: #797878;
    margin-bottom: 5px;
}

/* SERVICES DROPDOWN */
.services-toggle {
    color: #3e77aa;
    margin-top: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    font-size: 13px;
    user-select: none;
}

.services-toggle i {
    margin-right: 5px;
    transition: transform 0.2s;
}

.services-toggle.active i {
    transform: rotate(180deg);
}

.services-list {
    display: none;
    /* Hidden by default */
    margin-top: 10px;
    background: #f9f9f9;
    border-radius: 4px;
    padding: 10px;
}

.active .services-list {
    display: block;
}

/* For simple toggle class logic if needed, but we used JS slide */

.service-option {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 13px;
    cursor: pointer;
}

.service-option:last-child {
    margin-bottom: 0;
}

.service-option input {
    accent-color: #00a046;
}

.service-price {
    margin-left: auto;
    color: #221f1f;
    font-weight: 500;
}

/* Actions */
.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-left: auto;
}

.qty-control {
    display: flex;
    align-items: center;
    border: 1px solid #e9e9e9;
    border-radius: 4px;
    height: 40px;
}

.qty-btn {
    width: 36px;
    height: 100%;
    background: #fff;
    border: none;
    font-size: 18px;
    color: #3e77aa;
    cursor: pointer;
}

.qty-input {
    width: 44px;
    height: 100%;
    border: none;
    border-left: 1px solid #e9e9e9;
    border-right: 1px solid #e9e9e9;
    text-align: center;
    font-size: 16px;
    -moz-appearance: textfield;
    appearance: textfield;
    /* Standard */
}

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

.cart-item-price-block {
    text-align: right;
    min-width: 100px;
}

.price-old {
    text-decoration: line-through;
    color: #a6a5a5;
    font-size: 14px;
    display: block;
}

.price-current {
    color: #00a046;
    font-size: 22px;
    font-weight: 700;
    white-space: nowrap;
}

/* MENU DOTS */
.cart-item-menu-wrapper {
    position: relative;
    display: inline-block;
}

.cart-item-menu-btn {
    color: #a6a5a5;
    cursor: pointer;
    font-size: 18px;
    padding: 10px;
    transition: color 0.2s;
    background: none;
    border: none;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-item-menu-btn:hover {
    color: #221f1f;
}

/* The dropdown menu itself */
.cart-action-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: #fff;
    border: 1px solid #e9e9e9;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    width: 180px;
    z-index: 10;
    padding: 5px 0;
}

.cart-action-dropdown.active {
    display: block;
}

.cart-action-item {
    padding: 10px 15px;
    font-size: 14px;
    color: #221f1f;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.cart-action-item:hover {
    background: #f4f4f4;
}

.cart-action-item.delete-item {
    color: #f84147;
}

/* Footer & Checkout */
.cart-checkout-block {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 20px 24px;
    background: #f5f5f5;
    border-top: 1px solid #e9e9e9;
}

.cart-total-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.total-label {
    font-size: 16px;
    color: #221f1f;
}

.cart-total-price {
    font-size: 24px;
    font-weight: 700;
    color: #221f1f;
}

.cart-buttons-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.cart-checkout-btn {
    background: #00a046;
    color: white;
    font-size: 16px;
    font-weight: 500;
    padding: 12px 24px;
    border-radius: 4px;
    text-decoration: none;
    transition: background 0.2s;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
}

.cart-checkout-btn:hover {
    background: #008a3c;
    color: white;
}

.cart-continue-btn {
    background: #f5f5f5;
    color: #3e77aa;
    font-size: 14px;
    padding: 12px 16px;
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    height: 48px;
    border: 1px solid transparent;
}

.cart-continue-btn:hover {
    background: #e6e6e6;
    color: #3e77aa;
}

.currency {
    font-size: 0.8em;
    font-weight: 400;
}

/* Mass Actions Buttons */
/* Mass Actions Buttons - Hidden by default */
.cart-mass-actions {
    display: none;
    /* Controlled by JS */
    gap: 16px;
}

.cart-mass-actions .cart-icon-btn {
    background: none;
    border: none;
    color: #3e77aa;
    cursor: pointer;
    font-size: 18px;
    transition: color 0.2s;
}

.cart-mass-actions .cart-icon-btn:hover {
    color: #f84147;
}

@media (max-width: 768px) {

    /* Full Screen Modal Foundation */
    .novateplica-cart-overlay {
        align-items: flex-end;
    }

    .novateplica-cart-modal {
        height: 100%;
        max-height: 100%;
        width: 100%;
        max-width: 100%;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }

    /* Header */
    .cart-modal-header {
        padding: 16px 20px;
        flex-shrink: 0;
        background: #fff;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .cart-modal-title {
        font-size: 20px;
        font-weight: 700;
        color: #221f1f;
    }

    /* Controls Bar */
    .cart-controls-bar {
        padding: 12px 20px;
        background: #fff;
        border-bottom: 1px solid #f0f0f0;
        justify-content: space-between;
        flex-shrink: 0;
        align-items: center;
    }

    .cart-select-all {
        font-size: 14px;
        color: #221f1f;
        font-weight: 500;
        display: flex;
        align-items: center;
    }

    .cart-select-all input[type="checkbox"] {
        width: 20px;
        height: 20px;
        accent-color: #00a046;
        margin-right: 12px;
        cursor: pointer;
    }

    .cart-mass-actions .cart-icon-btn {
        font-size: 18px;
        color: #999;
    }

    /* Cart Body */
    .cart-modal-body {
        background: #fff;
        padding-bottom: 20px;
        overflow-x: hidden;
        overflow-y: auto;
        flex: 1;
        min-height: 0;
        -webkit-overflow-scrolling: touch;
    }

    /* --- ITEM LAYOUT (CSS Grid) --- */
    /* 
       Grid Areas:
       "check img info"
       "check img actions" 
    */
    .cart-item {
        display: grid;
        grid-template-columns: min-content 80px 1fr;
        grid-template-rows: min-content 1fr;
        grid-template-areas:
            "check img info"
            "check img actions";
        gap: 0;
        /* Removing gap to control spacing via margins */
        padding: 16px 12px;
        /* Reduced side padding (was 20px) to move image left */
        border-bottom: 1px solid #f0f0f0;
        position: relative;
        align-items: start;
        transition: background-color 0.2s;
    }

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

    /* 1. Checkbox (Always visible) */
    .cart-item-checkbox {
        grid-area: check;
        width: 28px;
        opacity: 1;
        margin-right: 8px;
        padding: 0;
        align-self: center;
        grid-row: 1 / span 2;
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;
    }

    .cart-item-checkbox input {
        width: 20px;
        height: 20px;
        margin: 0;
        cursor: pointer;
    }

    /* 2. Image */
    .cart-item-image-wrapper {
        grid-area: img;
        grid-row: 1 / span 2;
        /* Span both text and actions rows */
        width: 80px;
        height: 80px;
        background: #f9f9f9;
        border-radius: 6px;
        padding: 4px;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 1px solid #f5f5f5;
        margin-right: 0;
        /* Removed margin, using padding on content instead */
    }

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

    /* 3. Info (Title & Meta) */
    .cart-item-info {
        grid-area: info;
        margin-bottom: 8px;
        /* Gap between title and controls */
        padding-right: 25px;
        /* Avoiding dot overlap */
        padding-left: 28px;
        /* Force spacing from image (increased by 8px) */
    }

    .cart-item-title {
        font-size: 14px;
        font-weight: 500;
        line-height: 1.4;
        margin-bottom: 4px;
        color: #221f1f;
        display: block;
        overflow: visible;
        text-decoration: none;
        outline: none;
    }

    /* Remove underline on touch/hover for mobile title */
    .cart-item-title:hover,
    .cart-item-title:active,
    .cart-item-title:focus {
        text-decoration: none;
        color: #221f1f;
        /* Reset color to avoid red if desired, or keep red but no underline. User said 'remove underline'. I'll keep default color to be safe or just remove underline */
    }

    .title-more-link {
        color: #00a046;
        /* Green by default */
        cursor: pointer;
        white-space: nowrap;
        font-weight: 600;
        margin-left: 5px;
        display: inline-block;
        text-decoration: none;
    }

    .cart-item-meta {
        font-size: 11px;
        color: #999;
    }

    /* 4. Actions (Qty, Price, Dots) */
    .cart-item-actions {
        grid-area: actions;
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        margin: 0;
        padding: 0;
        padding-left: 28px;
        /* Force spacing from image (increased by 8px) */
        /* Align to bottom of the 'img' if content is short, usually img is 80px */
        align-self: end;
    }

    /* Qty Control */
    .qty-control {
        height: 32px;
        border: 1px solid #e0e0e0;
        border-radius: 4px;
        display: flex;
        background: #fff;
    }

    .qty-btn {
        width: 32px;
        font-size: 14px;
        color: #333;
        background: none;
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .qty-input {
        width: 36px;
        font-size: 14px;
        height: 100%;
        color: #221f1f;
        border: none;
        border-left: 1px solid #f0f0f0;
        border-right: 1px solid #f0f0f0;
        padding: 0;
        text-align: center;
    }

    /* Price */
    .cart-item-price-block {
        text-align: right;
        min-width: auto;
    }

    .price-current {
        font-size: 18px;
        font-weight: 700;
        color: #00a046;
        white-space: nowrap;
    }

    .price-old {
        font-size: 11px;
    }

    /* Menu Dots (Absolute to Card) */
    .cart-item-menu-wrapper {
        position: absolute;
        top: 14px;
        right: 10px;
        z-index: 2;
    }

    .cart-item-menu-btn {
        padding: 8px;
        color: #b0b0b0;
        font-size: 16px;
    }

    /* Ensure dropdown is visible */
    .cart-action-dropdown {
        right: -10px;
        top: 30px;
        width: 160px;
    }

    /* Footer */
    .cart-checkout-block {
        flex-direction: column;
        align-items: stretch;
        padding: 16px 20px;
        background: #fff;
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
        z-index: 10;
        flex-shrink: 0;
    }

    .cart-total-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 20px;
        width: 100%;
    }

    .total-label {
        font-size: 16px;
        font-weight: 500;
    }

    .cart-total-price {
        font-size: 24px;
        font-weight: 800;
        color: #221f1f;
        margin-left: 0;
    }

    .cart-buttons-row {
        display: flex;
        flex-direction: column;
        gap: 16px;
        align-items: center;
    }

    .cart-checkout-btn {
        width: 100%;
        height: 52px;
        font-size: 18px;
        font-weight: 600;
        border-radius: 8px;
        background-color: #00a046;
        order: 2;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #fff;
    }

    .cart-checkout-btn:hover {
        background-color: #008a3c;
    }

    .cart-continue-btn {
        width: auto;
        border: none;
        background: transparent;
        color: #3e77aa;
        font-size: 14px;
        padding: 0;
        height: auto;
        order: 1;
        display: inline-block;
    }

    .cart-continue-btn:hover {
        background: transparent;
        text-decoration: underline;
    }
}

/* Dark Mode Overrides for Cart Modal */
[data-theme="dark"] .novateplica-cart-modal {
    background: var(--card-bg);
    color: var(--text-color);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .cart-modal-header {
    border-bottom-color: var(--border-color);
    background: var(--card-bg);
}

[data-theme="dark"] .cart-modal-title {
    color: var(--text-color);
}

[data-theme="dark"] .cart-modal-close {
    color: var(--text-light);
}

[data-theme="dark"] .cart-modal-close:hover {
    color: var(--text-color);
}

[data-theme="dark"] .cart-controls-bar {
    background: var(--card-bg);
    border-bottom-color: var(--border-color);
    color: var(--text-color);
}

[data-theme="dark"] .cart-item {
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .cart-item-title {
    color: var(--text-color);
}

[data-theme="dark"] .cart-item-title:hover {
    color: var(--primary-color);
}

[data-theme="dark"] .cart-item-image-wrapper {
    background: var(--input-bg);
    border-color: var(--border-color);
}

[data-theme="dark"] .qty-control {
    background: var(--input-bg);
    border-color: var(--border-color);
}

[data-theme="dark"] .qty-btn {
    background: transparent;
    color: var(--text-color);
}

[data-theme="dark"] .qty-input {
    background: transparent;
    color: var(--text-color);
    border-left-color: var(--border-color);
    border-right-color: var(--border-color);
}

[data-theme="dark"] .price-current {
    color: var(--primary-color);
}

[data-theme="dark"] .price-old {
    color: var(--text-light);
}

[data-theme="dark"] .cart-item-menu-btn {
    color: var(--text-light);
}

[data-theme="dark"] .cart-item-menu-btn:hover {
    color: var(--text-color);
}

[data-theme="dark"] .cart-action-dropdown {
    background: var(--dropdown-bg);
    border-color: var(--border-color);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .cart-action-item {
    color: var(--text-color);
}

[data-theme="dark"] .cart-action-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .cart-checkout-block {
    background: var(--input-bg);
    border-top-color: var(--border-color);
}

[data-theme="dark"] .total-label,
[data-theme="dark"] .cart-total-price {
    color: var(--text-color);
}

[data-theme="dark"] .cart-continue-btn {
    background: transparent;
    color: var(--text-light);
}

[data-theme="dark"] .cart-continue-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
}

[data-theme="dark"] .cart-empty-state p {
    color: var(--text-color);
}

[data-theme="dark"] .cart-empty-icon {
    color: var(--border-color);
}

[data-theme="dark"] .cart-item-checkbox input,
[data-theme="dark"] .cart-select-all input[type="checkbox"] {
    filter: invert(0.85) hue-rotate(180deg) brightness(1.1);
}

/* Mobile Dark Mode Overrides */
@media (max-width: 768px) {

    [data-theme="dark"] .cart-modal-header,
    [data-theme="dark"] .cart-controls-bar,
    [data-theme="dark"] .cart-modal-body,
    [data-theme="dark"] .cart-checkout-block {
        background: var(--card-bg);
    }
}