/*
 * Login Via Email - scoped styles.
 *
 * Every selector is namespaced with "lve-". Nothing global is redefined, no
 * element selectors are used and no theme variable is overwritten, so the module
 * cannot alter the appearance of the surrounding WHMCS theme.
 *
 * Colours are expressed as CSS custom properties on the module root elements
 * only, which lets a theme author restyle the dialog without touching this file.
 */

.lve-inline-button {
    margin-left: 8px;
    vertical-align: middle;
}

/* When the theme stacks a full width submit button, follow suit. */
.lve-inline-button.lve-block {
    display: block;
    width: 100%;
    margin-left: 0;
    margin-top: 8px;
}

/* Fallback appearance only for themes with no .btn styling of their own. */
.lve-inline-button.lve-unstyled {
    display: inline-block;
    padding: 8px 14px;
    border: 1px solid currentColor;
    border-radius: 4px;
    background: transparent;
    color: inherit;
    font: inherit;
    line-height: 1.4;
    cursor: pointer;
    text-decoration: none;
}

.lve-inline-button:focus-visible,
.lve-modal-close:focus-visible,
.lve-submit:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* ------------------------------------------------------------------ Dialog */

.lve-overlay {
    --lve-surface: #ffffff;
    --lve-text: #1f2933;
    --lve-muted: #6b7280;
    --lve-border: rgba(0, 0, 0, 0.12);
    --lve-backdrop: rgba(17, 24, 39, 0.55);

    position: fixed;
    inset: 0;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 100050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: var(--lve-backdrop);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.lve-overlay[hidden] {
    display: none;
}

/* Prevent the page behind the dialog from scrolling. */
html.lve-modal-open,
html.lve-modal-open body {
    overflow: hidden;
}

.lve-dialog {
    position: relative;
    width: 100%;
    max-width: 420px;
    margin: auto;
    padding: 24px;
    border-radius: 8px;
    background: var(--lve-surface);
    color: var(--lve-text);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
    text-align: left;
    animation: lve-dialog-in 160ms ease-out;
}

@keyframes lve-dialog-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .lve-dialog { animation: none; }
}

.lve-modal-title {
    margin: 0 32px 8px 0;
    font-size: 1.25rem;
    line-height: 1.3;
    font-weight: 600;
    color: inherit;
}

.lve-modal-intro {
    margin: 0 0 18px;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--lve-muted);
}

.lve-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--lve-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.lve-modal-close:hover {
    color: var(--lve-text);
}

.lve-field {
    margin-bottom: 16px;
}

.lve-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.875rem;
    font-weight: 600;
}

.lve-input {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--lve-border);
    border-radius: 4px;
    background: #fff;
    color: var(--lve-text);
    font: inherit;
    font-size: 1rem; /* 16px keeps iOS from zooming the viewport on focus */
    line-height: 1.4;
    box-sizing: border-box;
}

.lve-input:focus {
    outline: 2px solid rgba(59, 130, 246, 0.6);
    outline-offset: 1px;
    border-color: rgba(59, 130, 246, 0.8);
}

.lve-input[aria-invalid="true"] {
    border-color: #dc2626;
}

.lve-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 4px;
}

.lve-status {
    margin: 14px 0 0;
    padding: 12px 14px;
    border-radius: 4px;
    font-size: 0.9375rem;
    line-height: 1.5;
}

.lve-status[hidden] {
    display: none;
}

.lve-status-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.lve-status-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.lve-busy {
    opacity: 0.65;
    pointer-events: none;
}

/* Honeypot: removed from the visual and accessibility trees, still submitted. */
.lve-hp {
    position: absolute !important;
    left: -9999px !important;
    top: auto !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
}

/* ------------------------------------------------- Login page notice banner */

.lve-notice {
    margin: 0 0 16px;
    padding: 12px 14px;
    border: 1px solid #fecaca;
    border-radius: 4px;
    background: #fef2f2;
    color: #991b1b;
    font-size: 0.9375rem;
    line-height: 1.5;
}

/* --------------------------------------------------- Themed fallback page */

.lve-page {
    margin: 24px 0 40px;
}

.lve-panel-title {
    margin: 0;
}

.lve-intro {
    margin-bottom: 18px;
}

.lve-page .lve-actions {
    margin-top: 8px;
}

.lve-back-link {
    font-size: 0.9375rem;
}

@media (max-width: 480px) {
    .lve-dialog {
        padding: 20px 18px;
    }

    .lve-actions {
        gap: 10px;
    }

    .lve-actions .lve-submit {
        width: 100%;
    }
}

/* Dark themes: follow the user agent preference for the dialog surface. */
@media (prefers-color-scheme: dark) {
    .lve-overlay {
        --lve-surface: #1f2430;
        --lve-text: #e8eaf0;
        --lve-muted: #a4abbb;
        --lve-border: rgba(255, 255, 255, 0.16);
    }

    .lve-input {
        background: #171b24;
        color: #e8eaf0;
    }
}
