/**
 * Speedy Login Modern Frontend UI
 */
:root {
    --spdlep-primary-color: #111827; /* Dynamically overridden by Customizer */
    --spdlep-border-radius: 8px;    /* Dynamically overridden by Customizer */
}

body .spdlep-auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    /* font-family: system-ui, -apple-system, sans-serif; */
}

.spdlep-woo-account-override .spdlep-auth-container {
    padding: 15px 0;
}

.spdlep-woo-account-override .spdlep-auth-card {
    max-width: 100%;
}

.spdlep-auth-card {
    background: #ffffff;
    width: 100%;
    max-width: 380px;
    border-radius: calc(var(--spdlep-border-radius) * 2);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0,0,0,0.03);
    padding: 32px;
    border: 1px solid #eaeaea;
}

.spdlep-frontend-help {
    background: #f0fdfa;
    border: 1px solid #ccfbf1;
    color: #0f766e;
    padding: 12px 16px;
    border-radius: var(--spdlep-border-radius);
    margin-bottom: 24px;
    font-size: 13px;
    line-height: 1.5;
}

.spdlep-frontend-help p {
    margin: 0 0 10px 0;
}

.spdlep-frontend-help p:last-child {
    margin-bottom: 0;
}

.spdlep-auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.spdlep-auth-title {
    font-size: 22px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 8px 0;
}

/* Ensure rich formatting aligns well */
.spdlep-auth-title p,
.spdlep-auth-title h1,
.spdlep-auth-title h2,
.spdlep-auth-title h3 {
    margin: 0;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
}

.spdlep-auth-subtitle {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

.spdlep-auth-subtitle p {
    margin: 0;
    color: inherit;
}

.spdlep-step {
    display: none;
    animation: spdlepFadeIn 0.3s ease forwards;
}

.spdlep-step.active {
    display: block;
}

@keyframes spdlepFadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Input Wrappers & Floating Labels */
.spdlep-input-wrapper {
    position: relative;
    margin-bottom: 20px;
}

body .spdlep-auth-container .spdlep-text-input {
    width: 100%;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: var(--spdlep-border-radius);
    padding: 22px 16px 10px;
    font-size: 0.8rem;
    color: #1f2937;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

body .spdlep-auth-container .spdlep-text-input:focus {
    background: #ffffff;
    border-color: var(--spdlep-primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.spdlep-floating-label {
    position: absolute;
    inset-inline-start: 16px; /* Native RTL Support */
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8rem;
    color: #9ca3af;
    pointer-events: none;
    transition: all 0.2s ease;
}

body .spdlep-auth-container .spdlep-text-input:focus ~ .spdlep-floating-label,
body .spdlep-auth-container .spdlep-text-input:not(:placeholder-shown) ~ .spdlep-floating-label {
    top: 14px;
    font-size: 12px;
    color: #6b7280;
}

body .spdlep-auth-container .spdlep-otp-input {
    letter-spacing: 2px;
    font-weight: 600;
    text-align: center;
}
body .spdlep-auth-container .spdlep-otp-input ~ .spdlep-floating-label {
    inset-inline: 0; /* Native RTL Support */
    text-align: center;
}

/* Back to Password Link */
.spdlep-back-to-pwd {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
}

.spdlep-back-to-pwd a {
    color: #4b5563;
    transition: color 0.2s ease;
}

.spdlep-back-to-pwd a:hover {
    color: var(--spdlep-primary-color);
}

/* User Badge for Step 2 */
.spdlep-user-badge {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f3f4f6;
    padding: 10px 14px;
    border-radius: var(--spdlep-border-radius);
    margin-bottom: 20px;
    font-size: 14px;
    color: #374151;
    font-weight: 500;
}

body .spdlep-auth-container .spdlep-btn-edit {
    background: none;
    border: none;
    color: var(--spdlep-primary-color);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

/* Buttons */
body .spdlep-auth-container .spdlep-btn {
    width: 100% !important;
    padding: 14px;
    border-radius: var(--spdlep-border-radius);
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
}

body .spdlep-auth-container .spdlep-btn-primary {
    background: var(--spdlep-primary-color);
    color: #ffffff;
}

body .spdlep-auth-container .spdlep-btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

body .spdlep-auth-container .spdlep-btn-secondary {
    background: transparent;
    border: 1px solid #d1d5db;
    color: #374151;
}

body .spdlep-auth-container .spdlep-btn-secondary:hover:not(.disabled-state) {
    background: #f9fafb;
}

body .spdlep-auth-container .spdlep-btn-secondary.disabled-state {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f3f4f6;
    color: #9ca3af;
}

/* Resend Button as Text Link */
body .spdlep-auth-container button[id^="spdlep_resend_"] {
    width: auto !important;
    margin: 8px auto 0;
    background: transparent !important;
    border: none !important;
    color: #4b5563 !important;
    padding: 8px 16px !important;
    font-size: 14px;
    font-weight: 500;
    box-shadow: none !important;
}

body .spdlep-auth-container button[id^="spdlep_resend_"]:hover:not(.disabled-state) {
    background: transparent !important;
    color: var(--spdlep-primary-color) !important;
}

body .spdlep-auth-container button[id^="spdlep_resend_"].disabled-state {
    background: transparent !important;
    color: #9ca3af !important;
    opacity: 1;
}

/* Loading Spinner */
body .spdlep-auth-container .spdlep-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spdlepSpin 0.8s linear infinite;
}

body .spdlep-auth-container .spdlep-btn.is-loading .spdlep-btn-text {
    display: none;
}

body .spdlep-auth-container .spdlep-btn.is-loading .spdlep-spinner {
    display: block;
}

@keyframes spdlepSpin {
    to { transform: rotate(360deg); }
}

/* Toast Notifications */
.spdlep-toast-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    pointer-events: none;
}

.spdlep-toast {
    padding: 14px 24px;
    border-radius: var(--spdlep-border-radius);
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    animation: spdlepToastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    display: flex;
    align-items: center;
    max-width: 350px;
    text-align: center;
    pointer-events: auto;
}

/* RTL override if absolute physical centering needs adjustments depending on container rendering */
.rtl .spdlep-toast-container,
[dir="rtl"] .spdlep-toast-container {
    left: 50%;
    transform: translateX(-50%);
}

.spdlep-toast.success { background-color: #10b981; }
.spdlep-toast.error { background-color: #ef4444; }

@keyframes spdlepToastSlideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.spdlep-debug-box {
    background: #fffbeb;
    border: 1px dashed #f59e0b;
    color: #b45309;
    padding: 12px;
    border-radius: var(--spdlep-border-radius);
    font-size: 13px;
    /* font-family: monospace; */
    margin-bottom: 20px;
    text-align: center;
    font-weight: 600;
}

.spdlep-mb-12 { margin-bottom: 12px; }
.spdlep-mb-20 { margin-bottom: 20px; }
.spdlep-mt-24 { margin-top: 24px; }
.spdlep-hidden { display: none !important; }
.spdlep-step-h4 { margin-top: 0; font-size: 18px; color: #111827; }
.spdlep-spinner-dark { border-top-color: #111827 !important; }