/**
 * Frontend Styles for Attributes User Access
 *
 * Implements responsive, accessible styles for authentication forms using
 * a modular architecture. Key features include:
 * - Mobile-first responsive design
 * - WCAG 2.1 AA compliance
 * - Theme compatibility
 * - RTL support
 * - Consistent visual hierarchy
 *
 * @package Attributes\Assets\CSS
 * @since 1.1.0
 */

/* -----------------------------------------------------------------------------
 * 1. Core Form Container
 * -------------------------------------------------------------------------- */

.attrua-form-wrapper {
    max-width: 480px;
    margin: 2rem auto;
    padding: 2rem;
    background: var(--attrua-form-bg, #ffffff);
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .attrua-form-wrapper {
        --attrua-form-bg: #1a1a1a;
        --attrua-text-color: #ffffff;
        --attrua-border-color: #333333;
    }
}

/* -----------------------------------------------------------------------------
 * 2. Form Elements
 * -------------------------------------------------------------------------- */

.attrua-form-description {
    font-size: 13px;
    background: #f3f4f6;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.attrua-form-row {
    margin-bottom: 1.5rem;
}

.attrua-form-row label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--attrua-label-color, #333333);
    font-weight: 500;
    font-size: 18px;
}

.attrua-form-row label .required {
    color: #F44336;
}

.attrua-form-row .description {
    font-size: 16px;
    font-style: italic;
    line-height: 1;
}

.attrua-input {
    width: 100%;
    width: -moz-available;
    /* WebKit-based browsers will ignore this. */
    width: -webkit-fill-available;
    /* Mozilla-based browsers will ignore this. */
    padding: 0.75rem;
    border: 1px solid var(--attrua-border-color, #d1d5db);
    border-radius: 0.375rem;
    background-color: var(--attrua-input-bg, #ffffff);
    color: var(--attrua-text-color, #1a1a1a);
    transition: border-color 0.2s ease;
}

.attrua-input:focus {
    outline: none;
    border-color: var(--attrua-primary-color, #2563eb);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

/* Password Field Container */
.attrua-password-field {
    position: relative;
}

/* Password Toggle Button */
.attrua-toggle-password {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    padding: 0.25rem;
    background: none;
    border: none;
    color: var(--attrua-icon-color, #6b7280);
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.attrua-toggle-password:hover {
    opacity: 1;
}

.attrua-instructions {
    margin: 1rem 0;
    padding: 1rem;
    background-color: var(--attrua-requirements-bg, #f3f4f6);
    border-radius: 0.375rem;
    font-size: 12px;
}

/* -----------------------------------------------------------------------------
 * 4. Password Requirements
 * -------------------------------------------------------------------------- */

.attrua-instructions,
.attrua-password-requirements {
    margin: 1rem 0;
    padding: 1rem;
    background-color: var(--attrua-requirements-bg, #f3f4f6);
    border-radius: 0.375rem;
    font-size: 12px;
}

.attrua-instructions h5,
.attrua-password-requirements h5 {
    margin-top: 0;
}

.attrua-password-requirements ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.attrua-password-requirements li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--attrua-text-muted, #6b7280);
    transition: color 0.2s ease;
}

.attrua-password-requirements li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b7280'%3E%3Cpath fill-rule='evenodd' d='M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-size: contain;
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.attrua-password-requirements li.met {
    color: var(--attrua-success-color, #059669);
}

.attrua-password-requirements li.met::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23059669'%3E%3Cpath fill-rule='evenodd' d='M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z' clip-rule='evenodd'/%3E%3C/svg%3E");
    opacity: 1;
}

/* -----------------------------------------------------------------------------
 * 5. Submit Button & Links
 * -------------------------------------------------------------------------- */

.attrua-submit-button {
    width: 100%;
    padding: 0.75rem 1.5rem;
    background-color: var(--attrua-primary-color, #2563eb);
    color: #ffffff;
    border: none;
    border-radius: 0.375rem;
    font-size: 20px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.attrua-submit-button:hover {
    background-color: var(--attrua-primary-dark, #1d4ed8);
}

.attrua-submit-button:disabled {
    background-color: var(--attrua-disabled-color, #9ca3af);
    cursor: not-allowed;
}

.attrua-form-links {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.875rem;
}

.attrua-form-links a {
    color: var(--attrua-link-color, #2563eb);
    text-decoration: none;
    transition: color 0.2s ease;
}

.attrua-form-links a:hover {
    color: var(--attrua-link-hover, #1d4ed8);
    text-decoration: underline;
}

.attrua-link-separator {
    margin: 0 0.5rem;
    color: var(--attrua-text-muted, #6b7280);
}

/* -----------------------------------------------------------------------------
 * 6. Messages & Errors
 * -------------------------------------------------------------------------- */

.attrua-message-container {
    margin-bottom: 1.5rem;
    padding: 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.attrua-message-container.error {
    background-color: var(--attrua-error-bg, #fee2e2);
    color: var(--attrua-error-text, #991b1b);
    border: 1px solid var(--attrua-error-border, #fecaca);
}

.attrua-message-container.success {
    background-color: var(--attrua-success-bg, #dcfce7);
    color: var(--attrua-success-text, #166534);
    border: 1px solid var(--attrua-success-border, #bbf7d0);
}

.attrua-field-error {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--attrua-error-text, #991b1b);
}

/* -----------------------------------------------------------------------------
 * 7. Responsive Design
 * -------------------------------------------------------------------------- */

@media (max-width: 640px) {
    .attrua-form-wrapper {
        margin: 1rem;
        padding: 1.5rem;
    }

    .attrua-form-row {
        margin-bottom: 1rem;
    }

    .attrua-password-requirements {
        padding: 0.75rem;
    }
}

/* -----------------------------------------------------------------------------
 * 8. RTL Support
 * -------------------------------------------------------------------------- */

[dir="rtl"] .attrua-toggle-password {
    right: auto;
    left: 0.75rem;
}

[dir="rtl"] .attrua-password-requirements li {
    padding-left: 0;
    padding-right: 1.5rem;
}

[dir="rtl"] .attrua-password-requirements li::before {
    left: auto;
    right: 0;
}

/* -----------------------------------------------------------------------------
 * 9. Accessibility Enhancements
 * -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {

    .attrua-input,
    .attrua-submit-button,
    .attrua-strength-meter::before {
        transition: none;
    }
}

.attrua-input:focus-visible,
.attrua-submit-button:focus-visible,
.attrua-toggle-password:focus-visible {
    outline: 2px solid var(--attrua-focus-ring, #3b82f6);
    outline-offset: 2px;
}

/* High Contrast Mode Adjustments */
@media (forced-colors: active) {
    .attrua-submit-button {
        border: 1px solid ButtonText;
    }

    .attrua-strength-meter::before {
        background-color: Highlight;
    }
}