/* =============================================
   Shopify-style One Page Checkout
   ============================================= */

/* ---------- Variables ---------- */
:root {
    --co-primary: #004595;
    --co-primary-light: #e8f0fb;
    --co-primary-hover: #003570;
    --co-primary-border: #6ba3d6;
    --co-gray-50: #f9fafb;
    --co-gray-100: #f3f4f6;
    --co-gray-200: #e5e7eb;
    --co-gray-300: #d1d5db;
    --co-gray-400: #9ca3af;
    --co-gray-500: #6b7280;
    --co-gray-900: #111827;
    --co-success: #059669;
    --co-success-bg: #ecfdf5;
    --co-radius-lg: 16px;
    --co-radius-md: 12px;
    --co-radius-sm: 10px;
}

/* ---------- Section ---------- */
.checkout-section {
    background: #fff;
    border: 1px solid var(--co-gray-200);
    border-radius: var(--co-radius-lg);
    padding: 24px;
    margin-bottom: 16px;
    transition: box-shadow .2s ease, border-color .2s ease;
}
.checkout-section:hover {
    border-color: var(--co-gray-300);
}
.checkout-section.is-loading {
    opacity: .6;
    pointer-events: none;
    animation: sectionPulse 1.2s ease-in-out infinite;
}
.checkout-section .section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.checkout-section .section-header .section-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--co-primary-light);
    color: var(--co-primary);
    border-radius: var(--co-radius-sm);
    font-size: 16px;
    flex-shrink: 0;
}
.checkout-section .section-header h2 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    color: var(--co-gray-900);
}
.checkout-section.completed .section-icon {
    background: var(--co-success-bg);
    color: var(--co-success);
}

/* ---------- Section States ---------- */
.checkout-section[data-status="pending"] .section-body {
    display: none;
}
.checkout-section[data-status="pending"]::after {
    content: 'Complete the above sections first';
    display: block;
    text-align: center;
    padding: 16px;
    color: var(--co-gray-400);
    font-size: .875rem;
}
.checkout-section[data-status="ready"] .section-body {
    display: block;
}
.checkout-section[data-status="ready"]::after {
    display: none;
}

/* ---------- Delivery / Pickup Toggle ---------- */
.delivery-toggle {
    display: flex;
    gap: 0;
    background: var(--co-gray-100);
    border-radius: var(--co-radius-md);
    padding: 4px;
    margin-bottom: 20px;
}
.delivery-toggle .toggle-btn {
    flex: 1;
    text-align: center;
    padding: 10px 16px;
    border-radius: var(--co-radius-sm);
    font-weight: 600;
    font-size: .9rem;
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--co-gray-500);
    transition: all .2s ease;
}
.delivery-toggle .toggle-btn.active {
    background: #fff;
    color: var(--co-gray-900);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
}
.delivery-toggle .toggle-btn i {
    margin-right: 6px;
}

/* ---------- Placeholder & Loader ---------- */
.section-content-placeholder {
    text-align: center;
    padding: 30px 0;
    color: var(--co-gray-400);
}
.section-content-placeholder i {
    font-size: 24px;
    display: block;
    margin-bottom: 8px;
}
.section-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 0;
    gap: 10px;
}
.section-loader .spinner-border {
    width: 20px;
    height: 20px;
}

/* ---------- Address Cards ---------- */
.card-address {
    border-radius: 14px;
    cursor: pointer;
    border: 2px solid var(--co-gray-200) !important;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .04);
    transition: all .2s ease;
    height: 100%;
    position: relative;
    padding: 16px;
}
.card-address:hover {
    border-color: var(--co-primary-border) !important;
    background: var(--co-primary-light);
}
.card-address.active {
    border-color: var(--co-primary) !important;
    background: var(--co-primary-light) !important;
    box-shadow: 0 0 0 3px rgba(0, 69, 149, .15), 0 2px 8px rgba(0, 0, 0, .06);
}
.card-address.active::after {
    content: "\f13b"; /* ci-check */
    font-family: cartzilla-icons;
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    background: var(--co-primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    line-height: 1;
}
.co-address-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--co-primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.co-address-icon i {
    color: var(--co-primary);
    font-size: 14px;
}
.co-address-name {
    font-size: .9rem;
    font-weight: 700;
}
.co-address-actions .btn {
    font-size: 11px;
    padding: 4px 10px;
}
.co-address-actions .btn i {
    font-size: 10px;
}
.co-address-detail {
    font-size: .82rem;
    color: var(--co-gray-500);
    line-height: 1.5;
    padding-left: 40px;
}
.co-address-detail .ci-phone {
    font-size: 10px;
    margin-right: 4px;
}
.co-address-hint {
    font-size: .85rem;
}
.co-new-address-icon {
    font-size: 11px;
}

/* ---------- Address Modal ---------- */
.co-modal .modal-content {
    border-radius: var(--co-radius-lg);
    overflow: hidden;
}
.co-modal .modal-header {
    padding: 16px 20px 8px;
    border: 0;
    background: var(--co-gray-50);
}
.co-modal .modal-footer {
    padding: 12px 20px;
    border: 0;
    background: var(--co-gray-50);
}
.co-modal .modal-title i {
    color: var(--co-primary);
}

/* ---------- Method Option Cards ---------- */
.method-option {
    border: 1.5px solid var(--co-gray-200);
    border-radius: var(--co-radius-md);
    padding: 14px 16px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all .15s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}
.method-option:hover {
    border-color: var(--co-primary-border);
    background: var(--co-primary-light);
}
.method-option.active {
    border-color: var(--co-primary);
    background: var(--co-primary-light);
}
.method-option .form-check-input:checked {
    background-color: var(--co-primary);
    border-color: var(--co-primary);
}
.co-method-name {
    font-weight: 600;
    font-size: .9rem;
}
.co-method-desc {
    font-size: .78rem;
}
.co-method-fee {
    font-size: .9rem;
    font-weight: 600;
}
.co-method-badge-free {
    font-size: .78rem;
}
.co-method-logo {
    border-radius: 6px;
}

/* ---------- Reward Points ---------- */
.co-reward-option {
    background: #fffbeb;
    border-color: #fbbf24;
}

/* ---------- Checkout Alerts ---------- */
.co-alert {
    font-size: 13px;
    border-radius: var(--co-radius-sm);
    padding: .5rem .75rem;
}
.co-alert-sm {
    font-size: .85rem;
    border-radius: var(--co-radius-sm);
    padding: .5rem .75rem;
}
.co-alert-close {
    font-size: 10px;
    padding: 12px;
}

/* ---------- Pickup Points ---------- */
.co-pickup-hours {
    font-size: .75rem;
    color: var(--co-gray-500);
    margin-top: 2px;
}

/* ---------- Terms of Service ---------- */
.co-terms-box {
    background: var(--co-gray-50);
    border: 1px solid var(--co-gray-200);
    border-radius: var(--co-radius-sm);
    padding: .75rem;
}
.co-terms-label {
    font-size: .85rem;
    line-height: 1.5;
}

/* ---------- Place Order Button ---------- */
.btn-place-order {
    background: linear-gradient(135deg, #004595, #0062cc);
    border: none;
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
    padding: 14px 32px;
    border-radius: 14px;
    width: 100%;
    transition: all .2s ease;
    box-shadow: 0 4px 14px rgba(0, 69, 149, .25);
}
.btn-place-order:hover {
    background: linear-gradient(135deg, #003570, #004d99);
    box-shadow: 0 6px 20px rgba(0, 69, 149, .35);
    transform: translateY(-1px);
    color: #fff;
}
.btn-place-order:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
    color: white;
}
.btn-place-order .spinner-border {
    width: 18px;
    height: 18px;
    margin-right: 8px;
}

/* ---------- Order Note ---------- */
.order-note-area textarea {
    border-radius: var(--co-radius-md);
    border: 1.5px solid var(--co-gray-200);
    resize: vertical;
    min-height: 70px;
}
.order-note-area textarea:focus {
    border-color: var(--co-primary);
    box-shadow: 0 0 0 3px rgba(0, 69, 149, .1);
}

/* ---------- Sidebar ---------- */
.checkout-sidebar {
    position: sticky;
    top: 150px;
}
.checkout-sidebar .sidebar-card {
    background: #fff;
    border: 1px solid var(--co-gray-200);
    border-radius: var(--co-radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .04);
}

/* ---------- Order Summary ---------- */
.co-summary-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 12px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--co-gray-200);
}
.co-summary-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--co-primary-light);
    color: var(--co-primary);
    border-radius: 8px;
    font-size: 15px;
    flex-shrink: 0;
}
.co-summary-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--co-primary);
    margin: 0;
}
.co-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 8px 0;
    font-size: .875rem;
}
.co-summary-row-label {
    color: var(--co-gray-500);
}
.co-summary-row-value {
    font-weight: 600;
    color: var(--co-gray-900);
}
.co-summary-row.discount .co-summary-row-value {
    color: #dc2626;
}
.co-summary-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-top: 14px;
    margin-top: 6px;
    border-top: 2px solid var(--co-gray-200);
}
.co-summary-total-label {
    font-size: 1rem;
    font-weight: 700;
    color: var(--co-gray-900);
}
.co-summary-total-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--co-primary);
}
.co-summary-vat {
    font-size: .8rem;
    font-weight: 400;
    color: var(--co-gray-400);
}
.co-summary-reward {
    font-size: .8rem;
    background: #fef3c7;
    color: #92400e;
    padding: 3px 10px;
    border-radius: 20px;
}
.co-summary-gift-badge {
    background: var(--co-success);
    color: #fff;
    font-size: .78rem;
    padding: 2px 8px;
    border-radius: 6px;
}
.co-summary-remove-gc {
    font-size: .75rem;
    padding: 2px 8px;
}

/* ---------- Checkout Info Text ---------- */
.co-info-text {
    font-size: .8rem;
}

/* ---------- Utility ---------- */
.co-flex-shrink-0 {
    flex-shrink: 0;
}

/* ---------- Animations ---------- */
@keyframes sectionPulse {
    0%, 100% { opacity: .6; }
    50% { opacity: .4; }
}

/* ---------- Responsive ---------- */
@media (max-width: 575.98px) {
    .checkout-section {
        padding: 16px;
        border-radius: var(--co-radius-md);
    }
    .card-address {
        padding: 12px;
        border-radius: var(--co-radius-sm);
    }
}

/* =============================================
   Cart Page Revamp
   ============================================= */

/* --- Page Header --- */
.cart-page-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--co-primary-light);
    color: var(--co-primary);
    border-radius: var(--co-radius-sm);
    font-size: 18px;
    flex-shrink: 0;
}

/* --- Free Delivery Bar --- */
.cart-free-delivery-bar {
    background: var(--co-primary-light);
    border: 1px solid #cce0f5;
    border-radius: var(--co-radius-md);
    padding: 12px 16px;
}
.cart-free-delivery-bar.achieved {
    background: var(--co-success-bg);
    border-color: #a7f3d0;
}

/* --- Mini-Strip (Mobile >5 items) --- */
.cart-mini-strip {
    background: #fff;
    border: 1px solid var(--co-gray-200);
    border-radius: var(--co-radius-md);
    padding: 12px;
    margin-bottom: 16px;
}
.cart-mini-strip.cart-collapsed {
    margin: 0px;
    border: 0px;
    padding: 0px;
}
.cart-mini-scroll-wrap {
    overflow: hidden;
}
.cart-mini-scroll {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    padding-bottom: 4px;
    padding-top: 4px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}
.cart-mini-scroll::-webkit-scrollbar {
    height: 3px;
}
.cart-mini-scroll::-webkit-scrollbar-thumb {
    background: var(--co-gray-300);
    border-radius: 3px;
}
.cart-mini-card {
    flex: 0 0 80px;
    scroll-snap-align: start;
    text-align: center;
    text-decoration: none;
    color: inherit;
    position: relative;
}
.cart-mini-card.cart-item-error {
    border-color: #fca5a5;
    background: #ffdada;
}
.cart-mini-card img {
    width: 64px;
    height: 64px;
    max-height: 64px;
    object-fit: contain;
    border: 1px solid var(--co-gray-200);
    border-radius: 10px;
    padding: 4px;
    background: #fff;
}
.cart-mini-badge {
    position: absolute;
    top: -4px;
    right: 2px;
    background: var(--co-primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 8px;
    line-height: 1.4;
}
.cart-mini-price {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--co-gray-900);
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Cart Items List --- */
@media (max-width: 767.98px) {
    .cart-mobile-hidden {
        display: none;
    }
}

/* --- Cart Item Card --- */
.cart-item-card {
    background: #fff;
    border: 1px solid var(--co-gray-200);
    border-radius: var(--co-radius-md);
    margin-bottom: 12px;
    overflow: hidden;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.cart-item-card:hover {
    border-color: var(--co-gray-300);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .04);
}
.cart-item-card.cart-item-error {
    border-color: #fca5a5;
    background: #fef2f2;
}
.cart-item-warning-banner {
    background: #fef2f2;
    color: #dc2626;
    font-size: .78rem;
    padding: 6px 14px;
    border-bottom: 1px solid #fca5a5;
}
.cart-item-body {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px;
}

/* Image */
.cart-item-img {
    flex-shrink: 0;
    display: block;
}
.cart-item-img img {
    width: 90px;
    max-width: 90px;
    height: 90px;
    max-height: 90px;
    object-fit: contain;
    border-radius: 10px;
    border: 1px solid var(--co-gray-100);
    background: #fff;
    padding: 4px;
}

/* Info */
.cart-item-info {
    flex: 1;
    min-width: 0;
}
.cart-item-name {
    font-size: .9rem;
    font-weight: 600;
    color: var(--co-gray-900);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}
.cart-item-name:hover {
    color: var(--co-primary);
}
.cart-item-attrs {
    font-size: .75rem;
    color: var(--co-gray-500);
    margin-top: 4px;
    line-height: 1.5;
}
.cart-item-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    flex-wrap: wrap;
}

/* Qty Dropdown */
.cart-qty-wrapper {
    flex-shrink: 0;
}
.cart-qty-select {
    appearance: none;
    -webkit-appearance: none;
    background: var(--co-gray-50) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b7280'/%3E%3C/svg%3E") no-repeat right 10px center;
    border: 1.5px solid var(--co-gray-200);
    border-radius: 10px;
    padding: 6px 30px 6px 12px;
    font-size: .85rem;
    font-weight: 600;
    color: var(--co-gray-900);
    cursor: pointer;
    min-width: 64px;
    transition: border-color .15s ease;
}
.cart-qty-select:focus {
    border-color: var(--co-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 69, 149, .1);
}
.cart-qty-label {
    font-size: .85rem;
    font-weight: 600;
    color: var(--co-gray-500);
}

/* Price */
.cart-item-price {
    text-align: right;
}
.cart-item-subtotal {
    font-weight: 700;
    font-size: .95rem;
    color: var(--co-gray-900);
    white-space: nowrap;
}
.cart-item-discount {
    display: block;
    font-size: .72rem;
    color: #dc2626;
}
.cart-item-disc-max {
    display: block;
    font-size: .7rem;
    color: var(--co-gray-400);
}

/* Actions */
.cart-item-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
    align-self: center;
}
.cart-action-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--co-gray-200);
    border-radius: 10px;
    background: #fff;
    color: var(--co-gray-500);
    font-size: 15px;
    cursor: pointer;
    transition: all .15s ease;
    padding: 0;
    text-decoration: none;
}
.cart-action-btn:hover {
    border-color: var(--co-gray-400);
    color: var(--co-gray-900);
    background: var(--co-gray-50);
}
.cart-remove-btn:hover {
    border-color: #fca5a5;
    color: #dc2626;
    background: #fef2f2;
}
.cart-wishlist-btn.wishlist-saved {
    background: #fff7ed;
    border-color: #fdba74;
    color: #ea580c;
}

/* --- Empty Cart --- */
.cart-empty-state {
    background: #fff;
    border: 1px solid var(--co-gray-200);
    border-radius: var(--co-radius-lg);
    padding: 48px 24px;
}
.cart-empty-icon {
    width: 64px;
    height: 64px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--co-gray-100);
    color: var(--co-gray-400);
    border-radius: 50%;
    font-size: 28px;
}

/* --- Floating Checkout (Mobile / Tablet) --- */
.cart-floating-checkout {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1040;
    background: #fff;
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(0, 0, 0, .1);
    border-top: 1px solid var(--co-gray-200);
}
.cart-floating-total {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}
.cart-floating-checkout .btn-place-order {
    padding: 12px 24px;
    font-size: .95rem;
}

/* --- Cart Terms --- */
.cart-terms {
    background: var(--co-gray-50);
    border: 1px solid var(--co-gray-200);
    border-radius: var(--co-radius-sm);
    padding: 10px 12px;
}

/* --- Cart Tax Info --- */
.cart-tax-info a {
    color: var(--co-primary);
    text-decoration: underline;
}

/* --- Cart Responsive --- */
/* @media (max-width: 991.98px) {
    .cart-revamp {
        padding-bottom: 80px !important;
    }
} */

@media (max-width: 767.98px) {
    .cart-item-img img {
        width: 70px;
        height: 70px;
    }
    .cart-item-body {
        padding: 10px;
        gap: 10px;
    }
    .cart-item-meta {
        /* flex-direction: column;
        align-items: flex-start; */
        gap: 6px;
    }
    .cart-item-price {
        text-align: left;
    }
    .cart-item-actions {
        flex-direction: row;
        align-self: flex-start;
    }
    .cart-action-btn {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }
}

@media (min-width: 992px) {
    .cart-floating-checkout {
        display: none !important;
    }
}
