/* ==========================================================================
   Headshot Lead Magnets — Frontend Styles v1.1
   ========================================================================== */

/* ---- CTA Widget ---- */
.hlmag-cta {
    background: #ffffff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    max-width: 100%;
}

.hlmag-cta:hover {
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.hlmag-cta__image img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

.hlmag-cta__content {
    padding: 20px;
}

.hlmag-cta__title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1f36;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.hlmag-cta__desc {
    font-size: 14px;
    color: #555;
    line-height: 1.5;
    margin: 0 0 16px 0;
}

.hlmag-cta__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px 20px;
    background: #ff4242;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
    text-align: center;
    text-decoration: none;
    line-height: 1.4;
    margin: 0;
}

.hlmag-cta__btn:hover,
.hlmag-cta__btn:focus {
    background: #e03535;
    color: #ffffff;
    outline: none;
}

.hlmag-cta__btn:focus-visible {
    outline: 2px solid #ff4242;
    outline-offset: 2px;
}

/* ---- Modal ---- */
.hlmag-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

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

.hlmag-modal__backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 31, 54, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    cursor: pointer;
}

.hlmag-modal__container {
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
    max-width: 460px;
    width: calc(100% - 32px);
    max-height: 90vh;
    overflow-y: auto;
    padding: 32px;
    z-index: 1;
    transform: translateY(12px);
    transition: transform 0.25s ease;
}

.hlmag-modal.is-active .hlmag-modal__container {
    transform: translateY(0);
}

.hlmag-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
    line-height: 1;
    padding: 0;
}

.hlmag-modal__close:hover {
    background: #f0f0f0;
    color: #333;
}

.hlmag-modal__title {
    font-size: 20px;
    font-weight: 700;
    color: #1a1f36;
    margin: 0 0 6px 0;
    padding-right: 30px;
}

.hlmag-modal__desc {
    font-size: 14px;
    color: #666;
    margin: 0 0 24px 0;
    line-height: 1.5;
}

/* ---- Form ---- */
.hlmag-form__group {
    margin-bottom: 16px;
}

.hlmag-form__label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.hlmag-required {
    color: #ff4242;
}

.hlmag-optional {
    color: #999;
    font-weight: 400;
    font-size: 13px;
}

.hlmag-form__input {
    width: 100%;
    padding: 10px 16px !important;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    color: #333;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
    height: auto !important;
    line-height: 1.4 !important;
}

/* Force padding on all form inputs inside our modal (overrides Divi/theme) */
.hlmag-modal input.hlmag-form__input,
.hlmag-modal input[type="text"].hlmag-form__input,
.hlmag-modal input[type="email"].hlmag-form__input,
.hlmag-modal input[type="tel"].hlmag-form__input {
    padding: 10px 16px !important;
    height: auto !important;
    line-height: 1.4 !important;
    margin: 0 !important;
}

.hlmag-form__input:focus {
    outline: none;
    border-color: #ff4242;
    box-shadow: 0 0 0 3px rgba(255, 66, 66, 0.1);
}

.hlmag-form__input.has-error {
    border-color: #e53935;
}

.hlmag-form__error {
    font-size: 13px;
    color: #e53935;
    margin-top: 4px;
    min-height: 0;
}

/* Checkbox group */
.hlmag-form__group--checkbox {
    margin-top: 20px;
}

.hlmag-form__checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: #555;
    line-height: 1.5;
    cursor: pointer;
}

.hlmag-form__checkbox {
    margin-top: 2px;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    accent-color: #ff4242;
}

/* Submit button */
.hlmag-form__submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 20px;
    background: #ff4242;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
    margin-top: 20px;
}

.hlmag-form__submit:hover {
    background: #e03535;
}

.hlmag-form__submit:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.hlmag-form__submit:focus-visible {
    outline: 2px solid #ff4242;
    outline-offset: 2px;
}

/* CRITICAL: Loading state hidden by default via CSS — 
   style attributes get stripped by WP filters, CSS does not */
.hlmag-form__submit-loading {
    display: none;
}

.hlmag-form__submit-loading svg {
    animation: hlmag-spin 1s linear infinite;
}

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

/* Message */
.hlmag-form__message {
    margin-top: 12px;
    padding: 0;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
}

.hlmag-form__message.success {
    padding: 12px;
    background: #e8f5e9;
    color: #2e7d32;
}

.hlmag-form__message.error {
    padding: 12px;
    background: #ffebee;
    color: #c62828;
}

/* Body scroll lock */
body.hlmag-modal-open {
    overflow: hidden;
}

/* Back button (thank you page) */
.hlmag-back-btn {
    display: inline-block;
    padding: 14px 28px;
    background: #ff4242;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s ease;
    text-align: center;
}

.hlmag-back-btn:hover {
    background: #e03535;
    color: #ffffff;
}

/* Responsive */
@media (max-width: 480px) {
    .hlmag-modal__container {
        padding: 24px 20px;
        border-radius: 12px 12px 0 0;
        max-height: 85vh;
        align-self: flex-end;
    }
    .hlmag-cta__title {
        font-size: 16px;
    }
}
