﻿@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;900&display=swap');

/* ===================================
   CART PAGE WRAPPER (default WC /cart override)
   =================================== */
.cod-cart-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 16px 60px;
    font-family: 'Cairo', sans-serif;
}
.cod-cart-page *,
.cod-cart-page *::before,
.cod-cart-page *::after {
    font-family: inherit;
}

/* Fallback for merchants who place the shortcodes directly on a page
   without the .cod-cart-page wrapper (e.g. a manually built page). */
.cod-cart-products, .cod-cart-products *,
.cod-cart-empty, .cod-cart-empty *,
.cod-cart-summary, .cod-cart-summary *,
.cod-cart-modal, .cod-cart-modal * {
    font-family: 'Cairo', sans-serif;
}

/* Two-column layout: products take the remaining width, checkout form +
   summary sit in a fixed-width side column. In RTL pages the first grid
   column renders on the right, so products end up right / checkout left
   without any extra direction-specific rules. */
.cod-cart-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
    align-items: start;
}

.cod-cart-grid-checkout {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 24px;
}

@media (max-width: 860px) {
    .cod-cart-grid {
        grid-template-columns: 1fr;
    }
    .cod-cart-grid-checkout {
        position: static;
    }
}

/* ===================================
   CART PRODUCTS LIST
   =================================== */
.cod-cart-products {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cod-cart-empty {
    max-width: 420px;
    margin: 60px auto;
    text-align: center;
    padding: 48px 32px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, .06);
}

.cod-cart-empty-icon {
    width: 104px;
    height: 104px;
    margin: 0 auto 24px;
    border-radius: 50%;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cod-cart-empty svg {
    width: 46px;
    height: 46px;
    color: var(--lf-primary, #EF4444);
}

/* !important guards beat the theme's own h3/p/link resets on the WC /cart page */
.cod-cart-empty h3 {
    font-family: 'Cairo', sans-serif !important;
    font-size: 22px;
    font-weight: 700 !important;
    color: #1e293b !important;
    margin: 0 0 8px !important;
}

.cod-cart-empty p {
    font-family: 'Cairo', sans-serif !important;
    color: #64748b !important;
    margin: 0 !important;
    font-size: 15px;
}

.cod-cart-empty-btn {
    display: inline-block;
    margin-top: 28px;
    padding: var(--ast-primary-padding, 14px 40px) !important;
    background: var(--ast-primary-bg, var(--lf-primary, #EF4444)) !important;
    color: var(--ast-primary-color, #fff) !important;
    font-family: 'Cairo', sans-serif !important;
    font-weight: 700 !important;
    font-size: 15px;
    border: var(--ast-primary-border-width, 0) solid var(--ast-primary-border, transparent);
    border-radius: var(--ast-primary-radius, 50px) !important;
    text-decoration: none !important;
    cursor: pointer;
    transition: filter .15s, background .15s, color .15s, transform .2s ease;
}

.cod-cart-empty-btn:hover {
    filter: brightness(.92);
    transform: translateY(-2px);
    background: var(--ast-primary-hover-bg, var(--ast-primary-bg, var(--lf-primary, #EF4444))) !important;
    color: var(--ast-primary-hover-color, #fff) !important;
    border-color: var(--ast-primary-hover-border, var(--ast-primary-border, transparent));
}

.cod-cart-item {
    display: flex;
    gap: 16px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    transition: all 0.2s ease;
}

.cod-cart-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.cod-cart-item-image {
    flex-shrink: 0;
}

.cod-cart-item-image img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
}

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

.cod-cart-item-name {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.cod-cart-item-variations {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.variation-tag {
    background: #f1f5f9;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 13px;
    color: #475569;
}

.cod-cart-item-meta {
    display: flex;
    gap: 12px;
    font-size: 14px;
    color: #64748b;
}

.cod-cart-item-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

.cod-cart-edit-btn,
.cod-cart-remove-btn {
    padding: 8px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    color: #475569;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.cod-cart-remove-btn:hover {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

.cod-cart-item-price {
    flex-shrink: 0;
    text-align: left;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.item-subtotal {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
}

.item-delivery {
    font-size: 13px;
    color: #64748b;
}

.cod-cart-checkout-btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    margin-top: 16px;
}

.cod-cart-checkout-btn:hover {
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
}

/* ===================================
   EDIT MODAL
   =================================== */
.cod-cart-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    overflow-y: auto;
    padding: 20px;
}

.cod-cart-modal-content {
    max-width: 600px;
    margin: 40px auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.cod-cart-modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: #1e293b;
}

.cod-cart-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: #f1f5f9;
    border-radius: 6px;
    font-size: 24px;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cod-cart-modal-close:hover {
    background: #e2e8f0;
}

.cod-cart-modal-body {
    padding: 24px;
    max-height: 70vh;
    overflow-y: auto;
}

.cod-edit-loader {
    text-align: center;
    padding: 40px 20px;
}

.cod-edit-loader .spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 16px;
    border: 4px solid #e2e8f0;
    border-top-color: #121212;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

#codCartEditContent {
    direction: rtl;
    text-align: right;
}

#codCartEditContent > label {
    display: block;
    font-weight: 600;
    color: #475569;
    margin-bottom: 8px;
    margin-top: 20px;
}

#codEditProductName {
    font-size: 20px;
    color: #1e293b;
    margin: 0 0 20px 0;
}

.cod-edit-quantity {
    margin: 20px 0;
}

.cod-edit-quantity label {
    display: block;
    font-weight: 600;
    color: #475569;
    margin-bottom: 8px;
}

/* ── Quantity controls — always black, never themed ── */
.cod-qty {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cod-qty button {
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    border: 1.5px solid #000;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1;
    color: #000;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.cod-qty button:hover {
    background: #000;
    color: #fff;
}

.cod-qty input {
    width: 56px;
    height: 36px;
    text-align: center;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
}

/* ── Bundle cards — rendered using the merchant's chosen template's own classes
   (lf-t1-row / lf-t2-card / lf-t3-offer / lf-t4-card from lc-form-templates.css),
   so no separate cod-bundle-* styling is needed here. Each template class already
   carries its own spacing, so this wrapper stays a plain block container. ───── */
.cod-bundles-wrapper {
    display: block;
}

/* ── Variation units — match .lf-var-btn / .lf-var-swatch ───────────────────── */
.cod-unit-card + .cod-unit-card {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #e5e7eb;
}

.cod-unit-header .cod-unit-title {
    font-size: .78rem;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 6px;
}

.cod-variation-group-box {
    margin-bottom: 10px;
}

.cod-variation-group-name {
    font-size: .8rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: #1e293b;
}

.cod-variation-values {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cod-variation-value {
    padding: 5px 12px;
    height: 34px;
    border: 1.5px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: #1e293b;
    font-size: .85rem;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.cod-variation-value:hover {
    border-color: var(--lf-theme, #EF4444);
}

.cod-variation-value.active {
    border-color: var(--lf-theme, #EF4444);
    border-width: 2px;
    color: var(--lf-theme, #EF4444);
    background: rgba(239, 68, 68, .06);
}

.cod-variation-swatch {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    padding: 0;
    border: 2px solid transparent;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .12);
}

.cod-variation-swatch.active {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--lf-theme, #EF4444);
}

.cod-edit-price-preview {
    background: #f8fafc;
    border-radius: 8px;
    padding: 16px;
    margin-top: 20px;
}

.cod-cart-modal-footer {
    display: flex;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid #e2e8f0;
    direction: rtl;
}

.cod-btn-save {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    background: var(--lf-primary, #EF4444);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: filter .15s, transform .2s ease;
}

.cod-btn-save:hover:not(:disabled) {
    filter: brightness(.92);
    transform: translateY(-2px);
}

.cod-btn-save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.cod-btn-cancel {
    padding: 12px 24px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    color: #475569;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cod-btn-cancel:hover {
    background: #f1f5f9;
    color: #475569;
}

/* ===================================
   RESPONSIVE
   =================================== */
@media (max-width: 768px) {
    /* Keep the row layout — just shrink the thumbnail */
    .cod-cart-item {
        flex-direction: row;
        gap: 12px;
        padding: 12px;
    }

    .cod-cart-item-image {
        flex-shrink: 0;
    }

    .cod-cart-item-image img {
        width: 72px;
        height: 72px;
        object-fit: cover;
    }

    .cod-cart-item-name {
        font-size: 15px;
    }

    .cod-cart-item-price {
        flex-direction: column;
        justify-content: center;
        text-align: left;
    }

    .item-subtotal {
        font-size: 16px;
    }

    .cod-cart-modal-content {
        margin: 20px auto;
    }
}