/* ==========================================
   1. Primary Trigger Button (High Priority)
   ========================================== */
a.custom-popup-trigger-btn,
button.custom-popup-trigger-btn,
.custom-popup-trigger-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background-color: #2563eb !important; /* Default Blue */
    color: #ffffff !important;            /* White text */
    font-size: 16px !important;
    font-weight: 600 !important;
    padding: 12px 32px !important;
    border-radius: 50px !important;       /* Capsule pill shape */
    border: none !important;
    outline: none !important;
    cursor: pointer !important;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease !important;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3) !important;
    text-decoration: none !important;
    -webkit-tap-highlight-color: transparent;
}

/* ==========================================
   2. Forced Hover & Active State (Turns Red)
   ========================================== */
body a.custom-popup-trigger-btn:hover,
body button.custom-popup-trigger-btn:hover,
body .custom-popup-trigger-btn:hover,
body a.custom-popup-trigger-btn:active,
body button.custom-popup-trigger-btn:active,
body .custom-popup-trigger-btn:active,
body a.custom-popup-trigger-btn:focus,
body button.custom-popup-trigger-btn:focus,
body .custom-popup-trigger-btn:focus {
    background-color: #dc2626 !important; /* Red background on Hover/Touch */
    color: #ffffff !important;            /* Keep text white */
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 16px rgba(220, 38, 38, 0.4) !important; /* Red glow */
}

/* ==========================================
   3. Modal Overlay Backdrop
   ========================================== */
.custom-popup-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.65) !important;
    z-index: 999999 !important;
    display: none; /* Hidden by default */
    align-items: center !important;
    justify-content: center !important;
    padding: 20px;
    box-sizing: border-box;
}

/* Activated Modal State */
.custom-popup-overlay.is-active {
    display: flex !important;
}

/* ==========================================
   4. Modal Container
   ========================================== */
.custom-popup-container {
    position: relative !important;
    background: #ffffff !important;
    padding: 35px 25px 25px 25px !important;
    border-radius: 12px !important;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25) !important;
    width: 1100px !important;
    max-width: 90vw !important;
    max-height: 85vh !important;
    overflow-y: auto !important; /* Vertical scroll if content overflows */
    box-sizing: border-box !important;
    animation: popupFadeIn 0.25s ease-out;
}

/* Entrance Animation */
@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ==========================================
   5. Modal Close Button
   ========================================== */
.custom-popup-close {
    position: absolute !important;
    top: 12px !important;
    right: 15px !important;
    font-size: 28px !important;
    line-height: 1 !important;
    color: #333333 !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    z-index: 100 !important;
    padding: 5px !important;
    transition: color 0.2s ease, transform 0.2s ease;
}

.custom-popup-close:hover {
    color: #dc2626 !important;
    transform: scale(1.15);
}

/* ==========================================
   6. Metform Container Fixes
   ========================================== */
.custom-popup-body {
    width: 100% !important;
}

.custom-popup-body .mf-container,
.custom-popup-body .metform-form-content {
    width: 100% !important;
    max-width: 100% !important;
}