/* ==========================================
   Checkout Modal – Premium Pop-up
   ========================================== */

/* Lock body scroll when modal is open */
body.cod-modal-open {
    overflow: hidden !important;
}

.cod-modal {
    position: fixed;
    inset: 0;
    z-index: 200000;
    display: block;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
    padding: 10px 10px 80px; 
    top: 0;
}

/* Adjust for WordPress Admin Bar */
.admin-bar .cod-modal {
    top: 32px;
}

@media screen and (max-width: 782px) {
    .admin-bar .cod-modal {
        top: 46px;
    }
}

.cod-modal.active {
    opacity: 1;
    visibility: visible;
}

.cod-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.1); /* Crystal clear white tint */
    backdrop-filter: blur(3px); /* Subtle, clean blur */
    -webkit-backdrop-filter: blur(3px);
}

.cod-modal-container {
    position: relative;
    background: #fff;
    width: 100%;
    direction: ltr !important;
    margin: 40px auto; 
    max-width: 480px;
    border-radius: 16px;
    overflow: visible;
    transform: none;
    transition: none;
    border: 1.5px solid var(--primary); /* Brand color border */
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.cod-modal.active .cod-modal-container {
    transform: none;
}

.cod-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    color: #666;
    transition: color 0.2s;
    box-shadow: none;
}

.cod-modal-close:hover {
    color: #333;
}

/* Cart Items Preview inside modal */
.cart-items-preview {
    background: transparent;
    padding: 0;
    /* Edge-to-edge with negative margin */
    margin: 0 -25px 20px -25px; 
    padding: 10px 25px;
    border-bottom: 1.5px solid #eef2f6;
    border-top: 1px solid #eef2f6;
}

.cart-preview-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px dashed #f1f5f9;
}

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

.preview-item-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.preview-img {
    position: relative;
    width: 40px;
    height: 40px;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.preview-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.preview-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--primary, #718096);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1.5px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.preview-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: left;
}

.preview-title {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.preview-price {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.8rem;
}

/* Sale price styling inside preview */
.preview-price del {
    color: #94a3b8;
    font-weight: 400;
    font-size: 0.75rem;
    text-decoration: line-through;
    margin-right: 4px;
}

.preview-price ins {
    color: #ef4444;
    font-weight: 700;
    text-decoration: none;
    font-size: 0.8rem;
}

.preview-remove {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 5px;
    margin-right: 10px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.preview-remove:hover {
    color: #ef4444;
    transform: scale(1.1);
}

/* Base Form override in modal */
.cod-modal .checkout-native-wrapper {
    margin: 0;
}

.cod-modal .checkout-native-container {
    border: none !important;
    box-shadow: none !important;
    padding: 55px 25px 25px; /* Large top padding for 'x' button */
}

/* Scrollbar styling for modal */
/* No internal scrollbar needed as entire modal scrolls */

/* Hide unwanted WC-native notice wrappers/errors inside modal */
.cod-modal .woocommerce-notices-wrapper,
.cod-modal .woocommerce-error,
.cod-modal .woocommerce-message,
.cod-modal .woocommerce-info {
    display: none !important;
}

/* Adjustments for mobile */
@media (max-width: 480px) {
    .cod-modal {
        padding: 10px;
    }
    .cod-modal-container {
        border-radius: 16px;
    }
    .cod-modal .checkout-native-container {
        padding: 20px 15px;
    }
}

/* Empty State in Modal */
.empty-cart-modal .cart-empty-state {
    padding: 60px 20px;
    text-align: center;
}

.empty-cart-modal .cart-empty-state h3 {
    font-size: 1.2rem;
    color: #1e293b;
    margin-bottom: 20px;
}

/* ==========================================
   Native Checkout Form – Brand Themed
   ========================================== */

.checkout-native-wrapper {
    margin: 25px 0;
    width: 100%;
    direction: ltr !important;
}

/* Container: 1px border with brand color */
.checkout-native-container {
    background: #fff;
    border: 1px solid var(--primary);
    border-radius: 14px;
    padding: 22px 18px;
    max-width: 100%;
}

/* Header */
.checkout-native-header {
    text-align: center;
    margin-bottom: 16px;
    border: none; /* Removed divider */
    padding-bottom: 0;
}

.checkout-native-title {
    font-size: 1.35rem;
    font-weight: 900;
    text-transform: uppercase;
    color: #1a1a1a;
    margin-bottom: 3px;
    letter-spacing: 0.5px;
}

.checkout-native-subtitle {
    color: #888;
    font-size: 0.8rem;
    margin: 0;
}

/* Form */
.checkout-native-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Fields – ALWAYS single column */
.checkout-native-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Each field: straight corners (no pill), clean border */
.native-field-group {
    display: flex;
    align-items: center;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    transition: border-color 0.2s ease;
    height: 44px;
}

.native-field-group:focus-within {
    border-color: var(--primary);
}

/* Icon: full-height background strip */
.native-icon {
    width: 44px;
    min-width: 44px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    background: var(--input-icon-bg, #f2f9f9);
    border-right: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.native-icon svg {
    width: 18px;
    height: 18px;
    stroke: var(--primary);
    color: var(--primary);
}

/* Input */
.native-field-group input,
.native-field-group textarea {
    flex-grow: 1;
    border: none !important;
    outline: none !important;
    padding: 0 14px;
    font-size: 16px; /* Optimized for iOS anti-zoom */
    color: #333;
    background: transparent;
    height: 100%;
    box-shadow: none !important;
}

.native-field-group input::placeholder {
    color: #adb5bd;
    font-weight: 400;
}

/* Phone Field Professional Styling (Unified) */
.unified-phone-field {
    padding-left: 12px;
}

.phone-prefix-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 10px;
    border-right: 1.5px solid #eee;
    height: 60%;
    margin: auto 0;
    flex-shrink: 0;
    user-select: none;
}

.flag-wrapper svg {
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: block;
}

.phone-prefix-text {
    font-size: 0.95rem;
    font-weight: 800;
    color: #1a1a1a;
    letter-spacing: -0.2px;
}

.unified-phone-field input {
    padding-left: 14px !important;
    font-weight: 600;
}

/* Success/Error Adjustments for Unified Field */
.unified-phone-field.valid-field {
    border-width: 1.5px;
}

.unified-phone-field.invalid-field {
    border-width: 1.5px;
}

.unified-phone-field.invalid-field .phone-prefix-container {
    border-right-color: #fca5a5;
}

/* Validation Feedback States */
.native-field-group.valid-field {
    border-color: #10b981 !important;
    background: #f0fdf4;
}

.native-field-group.invalid-field {
    border-color: #ef4444 !important;
}

.native-field-group.invalid-field .phone-prefix {
    border-right-color: #fca5a5;
    background: #fef2f2;
}

/* Specific Shake for fields */
@keyframes field-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.native-field-group.shake-animation {
    animation: field-shake 0.2s ease-in-out 2;
}



/* ====== Quantity ====== */
.native-qty-area {
    background: #f7f8fa;
    padding: 8px 16px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 2px;
}

.native-label {
    font-weight: 700;
    color: #1a1a1a;
    font-size: 0.82rem;
}

.native-qty-selector {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
}

.native-qty-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: #f7f8fa;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    color: #333;
    transition: background 0.15s;
}

.native-qty-btn:hover {
    background: #edf0f3;
}

.native-qty-selector input {
    width: 32px;
    text-align: center;
    border: none !important;
    border-left: 1px solid #e5e7eb !important;
    border-right: 1px solid #e5e7eb !important;
    font-weight: 800;
    font-size: 0.9rem;
    background: #fff;
    outline: none !important;
    height: 30px;
}

/* ====== Summary ====== */
.native-summary {
    background: #f8fafc;
    padding: 15px;
    border-radius: 12px;
    margin: 10px 0 25px 0;
    border: 1px solid #f1f5f9;
}

.native-summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3px;
    font-size: 0.82rem;
    color: #555;
}

.native-summary-total {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #eaeaea;
    font-size: 1rem;
    font-weight: 900;
    color: #111;
}

.native-total {
    color: var(--primary);
}

/* ====== Submit Button – compact ====== */
.native-submit-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 10px 16px;
    cursor: pointer;
    width: 100%;
    margin-top: 2px;
    /* NO transition here – it conflicts with shake animation */
}

.native-submit-btn:hover {
    background: var(--primary-dark);
    box-shadow: 0 3px 10px rgba(var(--primary-rgb), 0.35);
}

.native-btn-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.native-btn-wrap > svg {
    flex-shrink: 0;
}

.native-btn-labels {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.native-btn-main {
    font-size: 1rem;
    font-weight: 900;
}

.native-btn-sub {
    font-size: 0.68rem;
    opacity: 0.9;
}

/* Shake Animation – stronger & clearly visible */
.native-submit-btn.shake-animation {
    animation: premium-shake 3s ease-in-out infinite;
}

@keyframes premium-shake {
    0%, 100% { transform: translateX(0); }
    5%, 15%, 25% { transform: translateX(-4px); }
    10%, 20% { transform: translateX(4px); }
    30% { transform: translateX(0); }
}

/* Loading Spinner */
.cod-spinner {
    animation: cod-spin 1s linear infinite;
    flex-shrink: 0;
}

@keyframes cod-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Disabled button during submission */
.native-submit-btn:disabled {
    opacity: 0.8;
    cursor: wait;
    pointer-events: none;
}

.native-submit-btn {
    transition: background 0.3s ease;
}

.native-submit-btn.out-of-stock {
    background: #b91c1c !important; /* Dark Red for Out of Stock */
    color: #fff !important;
    box-shadow: none !important;
}

/* ====== Variation Swatches ====== */
.native-variations-area {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 6px;
}

.native-attr-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.native-attr-label {
    font-weight: 700;
    font-size: 0.82rem;
    color: #333;
}

.native-swatches-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Base swatch button */
.native-swatch {
    cursor: pointer;
    border: 2px solid #e5e7eb;
    transition: all 0.2s ease;
    position: relative;
    padding: 0;
    background: #fff;
}

.native-swatch.active {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 1px var(--primary);
}

/* Color Swatch */
.swatch-color {
    width: 34px;
    height: 34px;
    border-radius: 8px;
}

.swatch-color.active::after {
    content: '✓';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    font-weight: 900;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Image Swatch */
.swatch-image {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    overflow: hidden;
    padding: 0;
}

.swatch-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Text/Size Swatch */
.swatch-text {
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.swatch-text.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary) !important;
}

/* Out of Stock Swatch State */
.native-swatch.out-of-stock {
    cursor: not-allowed !important;
    position: relative;
    overflow: hidden;
}

.native-swatch.out-of-stock::after {
    content: "";
    position: absolute;
    top: 50%;
    left: -10%;
    width: 120%;
    height: 2px;
    background: #ef4444;
    transform: rotate(45deg);
    z-index: 5;
}

.native-swatch.out-of-stock img {
    filter: grayscale(1) opacity(0.5);
}

.selected-attr-name {
    color: var(--primary);
    font-weight: 800;
    margin-left: 4px;
}

/* ====== Hidden Variations (managed by offers) ====== */
.native-variations-area.hidden-by-offers {
    display: none !important;
}

/* ====== Frontend Offer Cards ====== */
.native-offers-area {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 6px;
}

.native-offer-card {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.native-offer-card.active {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb), 0.08); /* Dynamic background based on brand color */
}

.offer-card-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
}

/* Image: fills height, small margin from edges */
.offer-img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.offer-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.offer-label {
    font-weight: 800;
    font-size: 0.85rem;
    color: #1a1a1a;
}

.offer-subtitle {
    font-size: 0.72rem;
    color: #777;
}

    align-items: flex-end;
    text-align: left;

.offer-price {
    font-weight: 900;
    font-size: 0.95rem;
    color: var(--primary);
}

.offer-compare {
    font-size: 0.72rem;
    color: #aaa;
    text-decoration: line-through;
}

.offer-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--primary);
    color: #fff;
    font-size: 0.5rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 0 8px 0 4px;
    line-height: 1.3;
}

/* ====== Offer Variation Selectors ====== */
.offer-variations-zone {
    border-top: 1px dashed #e5e7eb;
    padding: 6px 10px 8px;
    display: none;
    flex-direction: column;
    gap: 6px;
}

.native-offer-card.active .offer-variations-zone {
    display: flex;
}

.offer-unit {
    display: flex;
    align-items: center;
    gap: 8px;
}

.offer-unit-label {
    font-weight: 800;
    font-size: 0.78rem;
    color: #999;
    min-width: 22px;
    flex-shrink: 0;
}

.offer-unit-selects {
    display: flex;
    gap: 6px;
    flex-grow: 1;
}

.offer-unit-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.offer-unit-field label {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.offer-var-select {
    width: 100%;
    height: 28px;
    padding: 0 24px 0 8px; /* Room for icon on the right */
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #ffffff;
    font-size: 13px;
    font-weight: 500;
    color: #1e293b;
    cursor: pointer;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    transition: all 0.2s ease;
}

.offer-var-select:focus {
    border-color: var(--primary);
    background-color: #fff;
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.1);
}
@media (max-width: 480px) {
    .checkout-native-wrapper {
        margin: 10px 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }
    .checkout-native-container {
        padding: 16px 12px;
        border: 1.5px solid var(--primary) !important;
        border-radius: 12px !important;
        width: 100% !important;
        margin: 0 !important;
    }
    .checkout-native-title {
        font-size: 1.15rem;
    }
    .native-field-group {
        height: 40px;
    }
    .native-icon {
        width: 38px;
        min-width: 38px;
    }
    .native-btn-main {
        font-size: 0.92rem;
    }
    .swatch-color { width: 30px; height: 30px; }
    .swatch-image { width: 36px; height: 36px; }
    .swatch-text  { height: 32px; font-size: 0.78rem; padding: 0 10px; }
    .offer-img { width: 36px; height: 36px; }
    .offer-label { font-size: 0.82rem; }
    .offer-price { font-size: 0.9rem; }
    .offer-var-select { font-size: 12px; height: 26px; }
}
/* ====== Free Shipping Progress Bar ====== */
.free-shipping-progress {
    margin-bottom: 25px;
    padding: 0;
    direction: ltr !important;
}

.progress-message {
    text-align: center;
    font-size: 0.88rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 15px;
    line-height: 1.4;
}

.progress-message .remaining-amount {
    color: var(--primary);
    font-weight: 800;
}

.progress-bar-container {
    position: relative;
    height: 10px;
    background: #f1f5f9;
    border-radius: 20px;
    overflow: visible !important;
}

.progress-bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--primary);
    border-radius: 20px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: visible !important;
    /* Subtle striped animation for progress */
    background-image: linear-gradient(
        45deg, 
        rgba(255, 255, 255, 0.15) 25%, 
        transparent 25%, 
        transparent 50%, 
        rgba(255, 255, 255, 0.15) 50%, 
        rgba(255, 255, 255, 0.15) 75%, 
        transparent 75%, 
        transparent
    );
    background-size: 20px 20px;
    animation: progress-stripes 1.5s linear infinite;
}

@keyframes progress-stripes {
    0% { background-position: 0 0; }
    100% { background-position: 20px 0; }
}



/* Success state styles */
.free-shipping-progress.is-complete .progress-bar-fill {
    background-color: #059669 !important;
}



.free-shipping-progress.is-complete .progress-message {
    color: #059669 !important;
}

.free-shipping-progress.is-complete .progress-message .remaining-amount {
    color: #059669 !important;
}
