/* MDI Pre-Checkout Modal Styles */

.mdi-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    /* Slate 900 with opacity */
    backdrop-filter: blur(8px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.4s;
}

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

.mdi-modal-container {
    background: #ffffff;
    width: 90%;
    max-width: 680px;
    height: 85vh;
    max-height: 800px;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.92);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.mdi-modal-overlay.active .mdi-modal-container {
    transform: scale(1);
}

/* Modal Header */
.mdi-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
}

.mdi-modal-title-group {
    display: flex;
    flex-direction: column;
}

.mdi-modal-title {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
    /* Slate 900 */
    margin: 0;
    line-height: 1.4;
}

.mdi-modal-subtitle {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 13px;
    color: #64748b;
    /* Slate 500 */
    margin: 4px 0 0 0;
}

.mdi-modal-close {
    background: #f8fafc;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s ease;
}

.mdi-modal-close:hover {
    background: #f1f5f9;
    color: #0f172a;
    transform: rotate(90deg);
}

.mdi-modal-close svg {
    width: 20px;
    height: 20px;
}

/* Modal Body / Iframe */
.mdi-modal-body {
    flex: 1;
    position: relative;
    background: #f8fafc;
}

.mdi-modal-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
}

/* Loader Overlay */
.mdi-loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: opacity 0.3s ease, visibility 0.3s;
}

.mdi-loader-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.mdi-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f1f5f9;
    border-top: 4px solid #3b82f6;
    /* Premium Accent Blue */
    border-radius: 50%;
    animation: mdi-spin 1s linear infinite;
}

.mdi-loader-text {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #475569;
    margin-top: 16px;
}

/* Checkout Banner / Notice */
/* Checkout Alert Container (Outer Card) */
.mdi-checkout-alert-container {
    background: #f6f6f6;
    border: 1px solid #e6e6e6;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    width: 100%;
}

/* Inner Warning Alert Box */
.mdi-checkout-alert-box {
    padding: 16px;
    border-radius: 6px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border: 1px solid transparent;
    box-sizing: border-box;
    width: 100%;
}

/* Pending Warning box (Shopify Aligned) */
.mdi-checkout-alert-box.mdi-status-pending {
    background: #fff6ed;
    border: 1px solid #ffd8be;
}

.mdi-checkout-alert-box.mdi-status-pending .mdi-alert-icon {
    color: #a75d00;
}

.mdi-checkout-alert-box.mdi-status-pending .mdi-alert-title {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #2d1500;
    margin: 0 0 6px 0;
}

.mdi-checkout-alert-box.mdi-status-pending .mdi-alert-description {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 13px;
    color: #5c3514;
    margin: 0;
    line-height: 1.5;
}

/* Success box (Shopify Aligned) */
.mdi-checkout-alert-box.mdi-status-success {
    background: #f4fdf8;
    border: 1px solid #c7f2da;
}

.mdi-checkout-alert-box.mdi-status-success .mdi-alert-icon {
    color: #16a34a;
}

.mdi-checkout-alert-box.mdi-status-success .mdi-alert-title {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #14532d;
    margin: 0 0 6px 0;
}

.mdi-checkout-alert-box.mdi-status-success .mdi-alert-description {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 13px;
    color: #166534;
    margin: 0;
    line-height: 1.5;
}

.mdi-alert-icon {
    flex-shrink: 0;
    margin-top: 2px;
}

.mdi-alert-content {
    flex: 1;
}

/* Primary Action Button (Blue Full-Width) */
.mdi-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0863d2 !important;
    color: #ffffff !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 14px 20px;
    border-radius: 6px;
    text-decoration: none !important;
    margin-top: 16px;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.mdi-action-btn:hover {
    background: #0053c0 !important;
}

/* Multiple intake actions (when API returns more than one pending voucher) */
.mdi-action-btn-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 16px;
    width: 100%;
}

.mdi-action-btn-group .mdi-action-btn {
    margin-top: 0;
    min-height: 46px;
}

/* Waiting Indicator Status */
.mdi-waiting-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 12.5px;
    color: #666666;
}

.mdi-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #e0e0e0;
    border-top: 2px solid #0863d2;
    border-radius: 50%;
    animation: mdi-spin 1s linear infinite;
    flex-shrink: 0;
}

/* Blocked payment button style */
.mdi-button-blocked {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    filter: grayscale(1) !important;
}

@keyframes mdi-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .mdi-modal-container {
        width: 95%;
        height: 90vh;
        max-height: none;
        border-radius: 16px;
    }

    .mdi-modal-header {
        padding: 16px;
    }

    .mdi-modal-title {
        font-size: 16px;
    }

    .mdi-action-btn-group {
        grid-template-columns: 1fr;
    }
}

/* Ready for Checkout Text (Success State) */
.mdi-ready-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #166534;
    /* Dark green matching the text */
}