/**
 * Ultimate Member Show/Hide Password Feature - CSS
 * 
 * Styles for password visibility toggle functionality in Ultimate Member registration and login forms.
 * Uses clickable text instead of icons with responsive design and accessibility features.
 * 
 * @package MemberWithCommunityTools
 * @version 1.1.0
 */

/* Password Toggle Text Styling */
.um-password-toggle-text {
    display: inline-block;
    margin-top: 5px;
    margin-left: 0;
    padding: 3px 6px;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 0.85em; /* Two font sizes smaller than labels */
    line-height: 1.2;
    text-decoration: none;
    user-select: none;
    transition: color 0.2s ease, text-decoration 0.2s ease;
    font-family: inherit;
}

/* Hover and Focus States */
.um-password-toggle-text:hover,
.um-password-toggle-text:focus {
    color: #333;
    text-decoration: underline;
    outline: 2px solid #0073aa;
    outline-offset: 2px;
    background: rgba(0, 115, 170, 0.1);
}

/* Active State */
.um-password-toggle-text:active {
    transform: none;
    color: #0073aa;
}

/* Visible State (when password is shown) */
.um-password-toggle-text.visible {
    color: #0073aa;
    font-weight: 500;
}

/* Remove default button styles */
.um-password-toggle-text::-moz-focus-inner {
    border: 0;
    padding: 0;
}

/* Container Adjustments */
.um-field-password,
.um-field-password_confirm,
.um-form-login .um-field {
    margin-bottom: 5px; /* Add space for toggle text */
}

/* Accessibility Improvements */
.um-password-toggle-text:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
    border-radius: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .um-password-toggle-text {
        color: #000;
        border: 1px solid #000;
        background-color: rgba(255, 255, 255, 0.9);
        padding: 4px 8px;
    }
    
    .um-password-toggle-text:hover,
    .um-password-toggle-text:focus {
        background-color: #fff;
        color: #000;
    }
    
    .um-password-toggle-text.visible {
        background-color: #000;
        color: #fff;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .um-password-toggle-text {
        color: #ccc;
    }
    
    .um-password-toggle-text:hover,
    .um-password-toggle-text:focus {
        color: #fff;
        background: rgba(74, 158, 255, 0.2);
    }
    
    .um-password-toggle-text.visible {
        color: #4a9eff;
    }
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    .um-password-toggle-text {
        font-size: 0.9em; /* Slightly larger on mobile for better touch targets */
        padding: 6px 10px;
        margin-top: 8px;
        /* Larger touch target for mobile */
        min-height: 30px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
    .um-password-toggle-text {
        font-size: 0.85em;
        padding: 5px 8px;
        margin-top: 6px;
    }
}

/* Animation for State Changes */
.um-password-toggle-text {
    transition: all 0.2s ease;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .um-password-toggle-text {
        transition: none;
    }
}

/* Ultimate Member Theme Compatibility */
.um form .um-field-password,
.um form .um-field-password_confirm,
.um form .um-field {
    position: relative;
}

/* Ensure proper spacing in different UM form layouts */
.um-form .um-password-toggle-text {
    clear: left;
    display: block;
    width: auto;
    margin-left: 0;
}

/* Style for different Ultimate Member form types */
.um-form-register .um-password-toggle-text,
.um-form-login .um-password-toggle-text {
    margin-top: 6px;
    font-size: 0.85em;
}

/* Print Styles - Hide toggle text when printing */
@media print {
    .um-password-toggle-text {
        display: none;
    }
}

/* Focus ring enhancement for better accessibility */
.um-password-toggle-text:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
    border-radius: 3px;
    box-shadow: 0 0 0 1px rgba(0, 115, 170, 0.3);
}

/* Ensure toggle text doesn't interfere with form validation messages */
.um-field .um-field-error + .um-password-toggle-text {
    margin-top: 3px;
}

/* Style for when toggle text is positioned after field area */
.um-field-area + .um-password-toggle-text {
    margin-top: 5px;
    margin-left: 0;
}
