/* =============================================================
   Lead Magnet – Frontend Popup Styles  (lead-magnet.css)
   Uses WordPress/theme CSS custom properties so the popup
   automatically inherits the active theme's colours & fonts.
   ============================================================= */

/* ── Overlay ──────────────────────────────────────────────── */
#lm-overlay {
    position: fixed;
    inset: 0;                           /* top/right/bottom/left = 0 */
    background: rgba(0, 0, 0, 0.60);
    z-index: 999999;
    display: flex;                      /* flex so popup is centred   */
    align-items: center;
    justify-content: center;
}

/* ── Popup card ───────────────────────────────────────────── */
#lm-popup {
    /* Exact dimensions requested */
    width:      400px;
    min-height: 300px;

    /* Inherit theme colours via CSS vars with safe fallbacks  */
    background: var(--wp--preset--color--base,       #ffffff);
    color:      var(--wp--preset--color--contrast,   #1e1e1e);

    /* Shape & depth */
    border-radius: 10px;
    box-shadow:    0 20px 60px rgba(0, 0, 0, 0.35);
    padding:       28px 30px 22px;
    box-sizing:    border-box;

    /* Inherit theme's font stack */
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

/* Thin accent stripe at the top using the theme's primary colour */
#lm-popup::before {
    content: '';
    display: block;
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--wp--preset--color--primary,    #0073aa);
    border-radius: 10px 10px 0 0;
}

/* ── Heading ──────────────────────────────────────────────── */
#lm-popup h2,
#lm-popup #lm-popup-title {
    margin:      0 0 14px;
    font-size:   1.25em;
    font-weight: 700;
    line-height: 1.3;
    color:       var(--wp--preset--color--primary, #0073aa);
    padding-bottom: 10px;
    border-bottom:  1px solid var(--wp--preset--color--tertiary, #e0e0e0);
}

/* ── Alert/message bar ────────────────────────────────────── */
#lm-message {
    display:       none;        /* shown via JS class toggle */
    font-size:     0.83em;
    padding:       7px 12px;
    border-radius: 5px;
    margin-bottom: 10px;
    font-weight:   500;
}
#lm-message.lm-success {
    display:    block;
    background: #d1fae5;
    color:      #065f46;
    border:     1px solid #6ee7b7;
}
#lm-message.lm-error {
    display:    block;
    background: #fee2e2;
    color:      #7f1d1d;
    border:     1px solid #fca5a5;
}

/* ── Form fields ──────────────────────────────────────────── */
.lm-field {
    margin-bottom: 10px;
}
.lm-field label {
    display:     block;
    font-size:   0.80em;
    font-weight: 600;
    margin-bottom: 3px;
    color:       var(--wp--preset--color--contrast, #333);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.lm-required {
    color: #e53e3e;
    margin-left: 2px;
}
.lm-field input[type="text"],
.lm-field input[type="email"],
.lm-field input[type="tel"] {
    width:        100%;
    padding:      7px 11px;
    border:       1px solid var(--wp--preset--color--tertiary, #d1d5db);
    border-radius: 5px;
    font-size:    0.88em;
    box-sizing:   border-box;
    font-family:  inherit;
    background:   var(--wp--preset--color--base,     #fff);
    color:        var(--wp--preset--color--contrast,  #333);
    transition:   border-color 0.15s, box-shadow 0.15s;
}
.lm-field input:focus {
    outline:      none;
    border-color: var(--wp--preset--color--primary,  #0073aa);
    box-shadow:   0 0 0 3px rgba(0, 115, 170, 0.15);
}

/* ── Button row ───────────────────────────────────────────── */
.lm-buttons {
    display:    flex;
    gap:        8px;
    margin-top: 14px;
}
.lm-btn {
    flex:          1;
    padding:       8px 10px;
    border:        none;
    border-radius: 5px;
    cursor:        pointer;
    font-size:     0.85em;
    font-weight:   600;
    font-family:   inherit;
    letter-spacing: 0.02em;
    transition:    opacity 0.2s, background 0.2s;
    white-space:   nowrap;
}

/* Submit */
.lm-btn-primary {
    background: var(--wp--preset--color--primary,  #0073aa);
    color:      #ffffff;
}
.lm-btn-primary:hover:not(:disabled)  { opacity: 0.88; }
.lm-btn-primary:active:not(:disabled) { opacity: 0.75; }

/* Download */
.lm-btn-secondary {
    background: var(--wp--preset--color--secondary, #23282d);
    color:      #ffffff;
}
.lm-btn-secondary:hover:not(:disabled)  { opacity: 0.88; }
.lm-btn-secondary:active:not(:disabled) { opacity: 0.75; }

/* Disabled state */
.lm-btn:disabled {
    opacity:  0.38;
    cursor:   not-allowed;
}

/* Cancel */
.lm-btn-cancel {
    background: transparent;
    color:      var(--wp--preset--color--contrast, #555);
    border:     1px solid var(--wp--preset--color--tertiary, #d1d5db);
}
.lm-btn-cancel:hover {
    background: var(--wp--preset--color--tertiary, #f3f4f6);
}

/* ── Responsive – narrow screens ─────────────────────────── */
@media (max-width: 460px) {
    #lm-popup {
        width:   calc(100vw - 32px);
        padding: 22px 18px 18px;
    }
    .lm-buttons {
        flex-wrap: wrap;
    }
    .lm-btn {
        flex: 1 1 45%;
    }
    .lm-btn-cancel {
        flex: 1 1 100%;
    }
}
