/* Employment Buddy - WP 2FA front-end styling
 *
 * Themes:
 *   - The Account Security section on /my-account/
 *   - The inline [wp-2fa-setup-form] shortcode output
 *   - The TOTP / Email setup modal that opens via MicroModal
 *
 * Uses Elementor's --e-global-color-primary variable when available
 * (the modal may be rendered outside an Elementor-styled context, so a
 * hex fallback to the brand orange #FF6C26 is provided).
 */

:root {
    --eb-2fa-primary: #FF6C26;
    --eb-2fa-primary-hover: #e25510;
    --eb-2fa-text: #1B2441;
    --eb-2fa-border: rgba(27, 36, 65, 0.15);
    --eb-2fa-font: 'Geologica', system-ui, -apple-system, sans-serif;
}

/* ---------- Section wrapper on /my-account/ ---------- */

section.account-security {
    margin: 2rem 0;
    padding: 0;
    font-family: var(--eb-2fa-font);
    color: var(--eb-2fa-text);
}

section.account-security h2 {
    font-family: var(--eb-2fa-font);
    color: var(--eb-2fa-text);
    margin: 0 0 0.75rem;
}

section.account-security > p {
    font-family: var(--eb-2fa-font);
    color: var(--eb-2fa-text);
    margin: 0 0 1rem;
    line-height: 1.6;
}

.eb-2fa-grace-banner {
    font-family: var(--eb-2fa-font);
    color: var(--eb-2fa-text);
    background: #FFF4EC;
    border: 1px solid var(--eb-2fa-primary);
    border-left-width: 4px;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin: 0 0 1.25rem;
    line-height: 1.6;
    max-width: 720px;
}

.eb-2fa-grace-banner strong {
    color: var(--eb-2fa-text);
    font-weight: 600;
}

.eb-2fa-grace-banner--expired {
    background: #FDECEC;
    border-color: #C0392B;
}

/* ---------- Inline WP 2FA setup form ---------- */

.wp-2fa-configuration-form,
form#your-profile.wp-2fa-configuration-form,
.wp-2fa-setup-form-wrapper {
    font-family: var(--eb-2fa-font);
    color: var(--eb-2fa-text);
    background: #fff;
    border: 1px solid var(--eb-2fa-border);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin: 0;
    max-width: 720px;
}

.wp-2fa-configuration-form h3,
form#your-profile h3 {
    font-family: var(--eb-2fa-font);
    color: var(--eb-2fa-text);
    margin: 1.5rem 0 0.75rem;
}

.wp-2fa-configuration-form strong {
    color: var(--eb-2fa-text);
}

/* ---------- form-table layout on the front-end ----------
 * WP 2FA renders the post-setup view as a wp-admin form-table.
 * On the front-end the admin CSS is absent, so labels (<th>) and
 * values (<td>) collapse together. These rules give the table a
 * proper two-column layout with visible labels, matching wp-admin.
 */

.wp-2fa-configuration-form table.form-table {
    border-collapse: collapse;
    width: 100%;
    margin: 0 0 1rem;
    font-family: var(--eb-2fa-font);
    color: var(--eb-2fa-text);
}

.wp-2fa-configuration-form table.form-table tr {
    display: table-row;
}

.wp-2fa-configuration-form table.form-table th,
.wp-2fa-configuration-form table.form-table td {
    display: table-cell;
    text-align: left;
    vertical-align: middle;
    padding: 1rem 1rem 1rem 0;
    border: none;
    background: transparent;
    color: var(--eb-2fa-text);
    font-family: var(--eb-2fa-font);
}

/* Extra breathing room when a row contains an action button - the
 * pill buttons have their own visual weight so neighbouring rows
 * need a generous gap to avoid looking glued together. */
.wp-2fa-configuration-form table.form-table td:has(.button) {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.wp-2fa-configuration-form table.form-table td .button {
    margin: 0.25rem 0;
}

.wp-2fa-configuration-form table.form-table th {
    width: 230px;
    font-weight: 600;
    color: var(--eb-2fa-text);
    padding-right: 1.5rem;
}

.wp-2fa-configuration-form table.form-table th label {
    font-weight: 600;
    color: var(--eb-2fa-text);
    font-family: var(--eb-2fa-font);
    margin: 0;
}

.wp-2fa-configuration-form table.form-table td {
    color: var(--eb-2fa-text);
}

/* Hide the "Show QR code" feature post-setup.
 * Re-displaying the TOTP secret to a logged-in user is a niche
 * convenience (pairing a second device) with real security cost
 * (anyone with a brief active session can copy the secret and create
 * a permanent 2FA they control). Customers who need to re-pair can
 * use the CHANGE 2FA SETTINGS button below, which generates a fresh
 * secret and invalidates the old one. */
.wp-2fa-configuration-form table.form-table tr:has(details summary.qr-btn) {
    display: none;
}


/* "10 unused backup codes remaining." status text next to the generate button */
.wp-2fa-configuration-form table.form-table td .description,
.wp-2fa-configuration-form table.form-table td > p {
    display: inline-block;
    margin: 0.5rem 0 0 0.75rem;
    color: var(--eb-2fa-text);
    opacity: 0.75;
    font-size: 0.95em;
    vertical-align: middle;
}

/* Responsive: stack on narrow screens */
@media (max-width: 640px) {
    .wp-2fa-configuration-form table.form-table th,
    .wp-2fa-configuration-form table.form-table td {
        display: block;
        width: 100%;
        padding: 0.5rem 0;
    }

    .wp-2fa-configuration-form table.form-table th {
        padding-bottom: 0.25rem;
        font-size: 0.95em;
        opacity: 0.85;
    }

    .wp-2fa-configuration-form table.form-table td .description,
    .wp-2fa-configuration-form table.form-table td > p {
        display: block;
        margin-left: 0;
        margin-top: 0.5rem;
    }
}

/* "Days remaining" countdown banner emitted by WP 2FA */
.wp-2fa-grace-banner,
.wp-2fa-notice,
.wp-2fa-required-notice {
    background: #fff4ec;
    border-left: 4px solid var(--eb-2fa-primary);
    padding: 0.75rem 1rem;
    margin: 0 0 1rem;
    border-radius: 4px;
    color: var(--eb-2fa-text);
    font-family: var(--eb-2fa-font);
}

/* ---------- Buttons ---------- */

/* Primary action: Configure 2FA / I'm Ready / Save / Next / Copy */
.wp-2fa-button-primary,
.modal__btn.wp-2fa-button-primary,
form.wp-2fa-form .button.button-primary,
form.wp-2fa-configuration-form .button.button-primary,
.account-security .button.button-primary {
    background-color: var(--eb-2fa-primary) !important;
    border: 2px solid var(--eb-2fa-primary) !important;
    color: #fff !important;
    border-radius: 999px !important;
    padding: 0.55rem 1.5rem !important;
    font-family: var(--eb-2fa-font) !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.02em !important;
    box-shadow: none !important;
    transition: background-color 150ms ease, border-color 150ms ease;
    cursor: pointer;
}

.wp-2fa-button-primary:hover,
.modal__btn.wp-2fa-button-primary:hover,
form.wp-2fa-form .button.button-primary:hover,
form.wp-2fa-configuration-form .button.button-primary:hover,
.account-security .button.button-primary:hover {
    background-color: var(--eb-2fa-primary-hover) !important;
    border-color: var(--eb-2fa-primary-hover) !important;
    color: #fff !important;
}

/* Secondary action: Cancel / Close / I'll do it later */
.wp-2fa-button-secondary,
.modal__btn.wp-2fa-button-secondary,
form.wp-2fa-form .button.button-secondary,
form.wp-2fa-configuration-form .button.button-secondary,
.account-security .button.button-secondary {
    background-color: #fff !important;
    color: var(--eb-2fa-text) !important;
    border: 2px solid var(--eb-2fa-text) !important;
    border-radius: 999px !important;
    padding: 0.55rem 1.5rem !important;
    font-family: var(--eb-2fa-font) !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.02em !important;
    box-shadow: none !important;
    transition: background-color 150ms ease, color 150ms ease;
    cursor: pointer;
}

.wp-2fa-button-secondary:hover,
.modal__btn.wp-2fa-button-secondary:hover {
    background-color: var(--eb-2fa-text) !important;
    color: #fff !important;
}

/* ---------- MicroModal popup (TOTP / Email setup wizard) ---------- */

.modal__overlay,
.wp-2fa-modal-wrapper .modal__overlay {
    background: rgba(27, 36, 65, 0.6);
}

.modal__container,
.wp-2fa-modal-wrapper .modal__container {
    font-family: var(--eb-2fa-font) !important;
    color: var(--eb-2fa-text) !important;
    border-radius: 12px !important;
    padding: 2rem !important;
    max-width: 640px;
}

.modal__title,
.wp-2fa-modal-wrapper .modal__title,
.modal__container h1,
.modal__container h2,
.modal__container h3 {
    font-family: var(--eb-2fa-font) !important;
    color: var(--eb-2fa-text) !important;
    margin-top: 0;
}

.modal__close,
.wp-2fa-modal-wrapper .modal__close {
    color: var(--eb-2fa-text) !important;
}

/* Numbered step circles in the TOTP setup wizard */
.modal__container ol > li::marker,
.wp-2fa-modal-wrapper [class*="step"] {
    color: var(--eb-2fa-primary);
}

/* The manual-entry code field + COPY button inside the TOTP wizard */
.modal__container input[type="text"],
.modal__container input[type="email"],
.modal__container input[type="number"] {
    font-family: var(--eb-2fa-font);
    border: 1px solid var(--eb-2fa-border);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    color: var(--eb-2fa-text);
}

.modal__container input:focus {
    outline: 2px solid var(--eb-2fa-primary);
    outline-offset: 1px;
}

/* ---------- OTP entry page (WP 2FA interstitial) ---------- *
 * Reached after a customer with 2FA configured submits credentials
 * via [edd_login]. WP 2FA renders this using wp-login.php's
 * login_header() chrome - we strip the WP logo and rebrand the card
 * so it feels like a continuation of the site.
 */

body.login {
    font-family: var(--eb-2fa-font) !important;
    background: #f4f4f6 !important;
    color: var(--eb-2fa-text) !important;
}

/* Replace the WordPress logo with the Employment Buddy logo.
 * The actual background-image URL is set via an inline <style> emitted
 * in inc/2fa-customer-policy.php (eb_2fa_login_head_logo) so it resolves
 * correctly per environment. Here we set everything else - dimensions,
 * positioning, and hiding the underlying link text. */
body.login h1 a {
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center center !important;
    width: 280px !important;
    height: 64px !important;
    text-indent: -9999px !important;
    overflow: hidden !important;
    display: block !important;
    margin: 0 auto 1.5rem !important;
    padding: 0 !important;
}

/* The white card containing the form */
body.login #login {
    padding: 5rem 0 0 !important;
    max-width: 480px;
    margin: 0 auto;
}

body.login form#lgraceform,
body.login form#loginform,
body.login form#login_2fa_form,
body.login .wp-2fa-login-form,
body.login form {
    background: #fff !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 20px rgba(27, 36, 65, 0.08) !important;
    border: 1px solid var(--eb-2fa-border) !important;
    padding: 2rem !important;
    font-family: var(--eb-2fa-font) !important;
    color: var(--eb-2fa-text) !important;
}

body.login label,
body.login p {
    color: var(--eb-2fa-text) !important;
    font-family: var(--eb-2fa-font) !important;
}

body.login input[type="text"],
body.login input[type="email"],
body.login input[type="number"],
body.login input[type="password"] {
    font-family: var(--eb-2fa-font) !important;
    border: 1px solid var(--eb-2fa-border) !important;
    border-radius: 6px !important;
    padding: 0.6rem 0.75rem !important;
    color: var(--eb-2fa-text) !important;
    background: #fff !important;
    box-shadow: none !important;
    font-size: 1rem;
}

body.login input:focus {
    outline: 2px solid var(--eb-2fa-primary) !important;
    border-color: var(--eb-2fa-primary) !important;
    outline-offset: 1px;
}

/* The Log In submit button at the bottom of the OTP form */
body.login .wp-core-ui .button-primary,
body.login p.submit input[type="submit"],
body.login input#wp-submit,
body.login input[type="submit"].button-primary {
    background-color: var(--eb-2fa-primary) !important;
    border: 2px solid var(--eb-2fa-primary) !important;
    color: #fff !important;
    border-radius: 999px !important;
    padding: 0.55rem 1.5rem !important;
    font-family: var(--eb-2fa-font) !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.02em !important;
    box-shadow: none !important;
    text-shadow: none !important;
    height: auto !important;
    line-height: 1.4 !important;
    cursor: pointer;
}

body.login .wp-core-ui .button-primary:hover,
body.login p.submit input[type="submit"]:hover,
body.login input#wp-submit:hover {
    background-color: var(--eb-2fa-primary-hover) !important;
    border-color: var(--eb-2fa-primary-hover) !important;
}

/* "Back to Employmentbuddy" link */
body.login #backtoblog a,
body.login #nav a {
    color: var(--eb-2fa-text) !important;
    font-family: var(--eb-2fa-font) !important;
    text-decoration: none;
}

body.login #backtoblog a:hover,
body.login #nav a:hover {
    color: var(--eb-2fa-primary) !important;
    text-decoration: underline;
}

/* Error and notice blocks on the OTP page */
body.login #login_error,
body.login .wp-2fa-error-msg {
    background: #fff4ec !important;
    border-left: 4px solid var(--eb-2fa-primary) !important;
    color: var(--eb-2fa-text) !important;
    font-family: var(--eb-2fa-font) !important;
    border-radius: 4px !important;
    padding: 0.75rem 1rem !important;
}
