/**
 * Custom Login Plugin Styles - Remove gray backgrounds
 */

/* Target the wrapper */
.custom-login-wrapper {
    background: transparent !important;
}

/* Remove form background and make transparent */
.custom-login-wrapper form,
.custom-login-wrapper #custom-loginform {
    background: none !important;
    background-color: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
}

/* Remove gray backgrounds from ALL form sections - AGGRESSIVE */
.custom-login-wrapper p,
.custom-login-wrapper form p,
.custom-login-wrapper #custom-loginform p,
.custom-login-wrapper p.login-username,
.custom-login-wrapper p.login-password,
.custom-login-wrapper p.login-remember,
.custom-login-wrapper p.login-submit {
    background: none !important;
    background-color: transparent !important;
    background-image: none !important;
    overflow: visible !important;
    padding: 10px 0 !important;
    margin: 10px 0 !important;
}

/* Remove scroll bars but keep input styling */
.custom-login-wrapper input[type="text"],
.custom-login-wrapper input[type="password"] {
    overflow: visible !important;
}

/* Ensure no overflow or background issues on any element */
.custom-login-wrapper *,
.custom-login-wrapper *::before,
.custom-login-wrapper *::after {
    overflow: visible !important;
    box-sizing: border-box;
}

/* Target any divs or containers that might have backgrounds */
.custom-login-wrapper > *,
.custom-login-wrapper div,
.custom-login-wrapper form > * {
    background: none !important;
    background-color: transparent !important;
    background-image: none !important;
}

/* ========================================
   FORGOT PASSWORD FORM STYLES
   ======================================== */

/* Apply same transparent background rules to forgot password form */
.custom-forgot-password-wrapper {
    background: transparent !important;
}

.custom-forgot-password-wrapper form,
.custom-forgot-password-wrapper #custom-lostpasswordform {
    background: none !important;
    background-color: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
}

.custom-forgot-password-wrapper p,
.custom-forgot-password-wrapper form p,
.custom-forgot-password-wrapper p.login-username,
.custom-forgot-password-wrapper p.login-submit {
    background: none !important;
    background-color: transparent !important;
    background-image: none !important;
    overflow: visible !important;
    padding: 10px 0 !important;
    margin: 10px 0 !important;
}

.custom-forgot-password-wrapper input[type="text"],
.custom-forgot-password-wrapper input[type="email"] {
    overflow: visible !important;
}

.custom-forgot-password-wrapper *,
.custom-forgot-password-wrapper *::before,
.custom-forgot-password-wrapper *::after {
    overflow: visible !important;
    box-sizing: border-box;
}

.custom-forgot-password-wrapper > *,
.custom-forgot-password-wrapper div,
.custom-forgot-password-wrapper form > * {
    background: none !important;
    background-color: transparent !important;
    background-image: none !important;
}

/* Success message styling */
.custom-password-reset-success {
    background-color: #d4edda !important;
    color: #155724 !important;
    padding: 12px !important;
    border-radius: 4px;
    margin-bottom: 20px !important;
    border: 1px solid #c3e6cb !important;
}

/* Error message styling */
.custom-password-reset-error {
    background-color: #f8d7da !important;
    color: #721c24 !important;
    padding: 12px !important;
    border-radius: 4px;
    margin-bottom: 20px !important;
    border: 1px solid #f5c6cb !important;
}

/* Login error message styling */
.custom-login-error {
    background-color: #f8d7da !important;
    color: #721c24 !important;
    padding: 12px !important;
    border-radius: 4px;
    margin-bottom: 20px !important;
    border: 1px solid #f5c6cb !important;
    border-left-width: 4px !important;
}

.custom-login-error p {
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
}

/* ========================================
   LOADING SPINNER STYLES
   ======================================== */

/* Button loading state */
.custom-login-wrapper input[type="submit"].loading,
.custom-forgot-password-wrapper input[type="submit"].loading {
    opacity: 0.7;
    cursor: not-allowed;
    position: relative;
    padding-right: 40px !important;
}

/* Spinner animation */
.custom-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
    position: absolute;
    right: 12px;
    top: 50%;
    margin-top: -8px;
}

/* Spinner animation for buttons */
.custom-login-wrapper .login-submit,
.custom-forgot-password-wrapper .login-submit {
    position: relative;
}

/* Keyframe animation for spinner */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Prevent double-click during loading */
.custom-login-wrapper input[type="submit"]:disabled,
.custom-forgot-password-wrapper input[type="submit"]:disabled {
    pointer-events: none;
    opacity: 0.7;
}

/* ========================================
   PASSWORD VISIBILITY TOGGLE
   ======================================== */

/* Password field wrapper positioning */
.custom-login-wrapper .login-password,
.custom-forgot-password-wrapper .login-password,
.login .login-password,
.login form p {
    position: relative !important;
}

/* Password toggle button - positioned relative to input field */
.password-toggle {
    position: absolute;
    right: 12px;
    top: auto;
    bottom: 0;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: color 0.3s ease;
    z-index: 10;
    outline: none;
    line-height: 1;
    margin-bottom: 0;
}

/* For shortcode forms - align with input field */
.custom-login-wrapper .login-password .password-toggle,
.custom-forgot-password-wrapper .login-password .password-toggle {
    height: 44px;
    bottom: 0;
}

/* For WordPress login page - different structure */
.login .password-toggle {
    height: 40px;
    bottom: 0;
    top: auto;
    transform: none;
}

.password-toggle:hover {
    color: #2271b1;
}

.password-toggle:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
    border-radius: 2px;
}

.password-toggle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.password-toggle-icon svg {
    width: 20px;
    height: 20px;
    display: block;
}

/* Add padding to password input to make room for toggle button */
.custom-login-wrapper input[type="password"],
.custom-login-wrapper input[type="text"].password-field,
.custom-forgot-password-wrapper input[type="password"],
.custom-forgot-password-wrapper input[type="text"].password-field,
.login input[type="password"],
.login input[type="text"][name="pwd"] {
    padding-right: 45px !important;
}

/* Ensure input fields have consistent height */
.custom-login-wrapper input[type="password"],
.custom-login-wrapper input[type="text"].password-field,
.custom-forgot-password-wrapper input[type="password"],
.custom-forgot-password-wrapper input[type="text"].password-field {
    height: 44px !important;
    line-height: 1 !important;
}

/* Ensure proper positioning on WordPress login page */
.login form .user-pass-wrap {
    position: relative !important;
}
