/* ==============================================
   POPUP LEAD-CAPTURE FORM — STYLES
   Global popup that appears on all pages.
   Glassmorphism design matching Magic Gates branding.
   ============================================== */

/* ===== OVERLAY ===== */
.mg-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 5, 40, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 99999;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.35s ease;
    padding: 20px;
}

.mg-popup-overlay.mg-popup-visible {
    display: flex;
    opacity: 1;
}

/* ===== POPUP CARD ===== */
.mg-popup-card {
    background: linear-gradient(145deg, #ffffff 0%, #f8f9ff 100%);
    border-radius: 18px;
    width: 100%;
    max-width: 440px;
    box-shadow:
        0 25px 60px rgba(0, 13, 110, 0.25),
        0 8px 20px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    position: relative;
    overflow: hidden;
    animation: mgPopupSlideIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transform: translateY(40px) scale(0.95);
    opacity: 0;
}

@keyframes mgPopupSlideIn {
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Close animation */
.mg-popup-card.mg-popup-closing {
    animation: mgPopupSlideOut 0.3s ease-in forwards;
}

@keyframes mgPopupSlideOut {
    to {
        transform: translateY(30px) scale(0.95);
        opacity: 0;
    }
}

/* ===== HEADER STRIP ===== */
.mg-popup-header {
    background: linear-gradient(135deg, #000d6e 0%, #001494 50%, #0019b3 100%);
    padding: 22px 28px 18px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Decorative shimmer */
.mg-popup-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 50%, rgba(240, 199, 0, 0.08) 0%, transparent 60%);
    pointer-events: none;
}

.mg-popup-header-icon {
    width: 42px;
    height: 42px;
    background: rgba(240, 199, 0, 0.15);
    border: 1.5px solid rgba(240, 199, 0, 0.35);
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.mg-popup-header-icon i {
    font-size: 18px;
    color: #f0c700;
}

.mg-popup-title {
    font-family: 'Playfair Display', serif;
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 4px;
    letter-spacing: 0.3px;
}

.mg-popup-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
    font-weight: 400;
}

/* ===== CLOSE BUTTON ===== */
.mg-popup-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
    z-index: 2;
    padding: 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    line-height: 1;
}

.mg-popup-close:hover {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
    transform: rotate(90deg);
}

/* ===== FORM BODY ===== */
.mg-popup-body {
    padding: 24px 28px 28px;
}

.mg-popup-form-group {
    margin-bottom: 16px;
    position: relative;
}

.mg-popup-form-group label {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.mg-popup-form-group label .mg-required {
    color: #e53e3e;
    margin-left: 2px;
}

.mg-popup-form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #e0e4f0;
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: #1a1a2e;
    background: #f8f9ff;
    transition: all 0.25s ease;
    outline: none;
    box-sizing: border-box;
}

.mg-popup-form-group input::placeholder {
    color: #a0a8c0;
    font-weight: 400;
}

.mg-popup-form-group input:focus {
    border-color: #000d6e;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(0, 13, 110, 0.08);
}

/* Validation error state */
.mg-popup-form-group input.mg-input-error {
    border-color: #e53e3e;
    background: #fff5f5;
    box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.08);
}

/* ===== SUBMIT BUTTON ===== */
.mg-popup-submit {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #000d6e 0%, #001494 100%);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
}

.mg-popup-submit::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.mg-popup-submit:hover {
    background: linear-gradient(135deg, #001494 0%, #0019b3 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 13, 110, 0.3);
}

.mg-popup-submit:hover::before {
    left: 100%;
}

.mg-popup-submit:active {
    transform: translateY(0);
}

.mg-popup-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.mg-popup-submit:disabled:hover {
    box-shadow: none;
}

/* Spinner icon animation */
.mg-popup-submit .fa-spin {
    animation: mgSpin 1s linear infinite;
}

@keyframes mgSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===== FORM MESSAGE ===== */
.mg-popup-message {
    display: none;
    padding: 10px 14px;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    margin-top: 14px;
    line-height: 1.4;
}

.mg-popup-message.mg-msg-success {
    display: block;
    background: #e6f9ed;
    color: #0f6b31;
    border: 1px solid #b8e9c9;
}

.mg-popup-message.mg-msg-error {
    display: block;
    background: #fff0f0;
    color: #c53030;
    border: 1px solid #fed7d7;
}

/* ===== TRUST BADGE ===== */
.mg-popup-trust {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #edf0f7;
}

.mg-popup-trust i {
    color: #28a745;
    font-size: 12px;
}

.mg-popup-trust span {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    color: #7a8299;
    font-weight: 500;
}

/* ===== BROCHURE CONTEXT BAR ===== */
.mg-popup-brochure-context {
    display: none;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #fffce6 0%, #fff9d6 100%);
    border: 1px solid #f0d800;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 18px;
}

.mg-popup-brochure-context.mg-context-visible {
    display: flex;
}

.mg-popup-brochure-context i {
    color: #b8960a;
    font-size: 16px;
    flex-shrink: 0;
}

.mg-popup-brochure-context span {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: #6b5a00;
    font-weight: 500;
    line-height: 1.4;
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 480px) {
    .mg-popup-overlay {
        padding: 12px;
        align-items: flex-end;
    }

    .mg-popup-card {
        max-width: 100%;
        border-radius: 18px 18px 0 0;
        animation: mgPopupSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
        transform: translateY(100%);
    }

    @keyframes mgPopupSlideUp {
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }

    .mg-popup-card.mg-popup-closing {
        animation: mgPopupSlideDown 0.3s ease-in forwards;
    }

    @keyframes mgPopupSlideDown {
        to {
            transform: translateY(100%);
            opacity: 0;
        }
    }

    .mg-popup-header {
        padding: 18px 20px 14px;
    }

    .mg-popup-title {
        font-size: 18px;
    }

    .mg-popup-body {
        padding: 20px 20px 24px;
    }

    .mg-popup-form-group input {
        padding: 11px 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
}
