/* Custom Authentication Styles */

/* Screen Reader Only - Accessibility */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Focus Management for Accessibility */
.custom-auth-field input:focus,
.custom-auth-field textarea:focus,
.custom-auth-button:focus,
.custom-auth-links a:focus {
    outline: 2px solid #007cba !important;
    outline-offset: 2px !important;
    border-color: #007cba !important;
    box-shadow: 0 0 0 2px rgba(0,124,186,0.2) !important;
}

/* Keyboard Navigation Support */
.custom-auth-button:focus-visible,
.custom-auth-links a:focus-visible {
    outline: 2px solid #007cba !important;
    outline-offset: 2px !important;
}

/* Skip Link for Keyboard Users */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #007cba;
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
}

.skip-link:focus {
    top: 6px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .custom-auth-field input {
        border-width: 2px;
    }
    
    .custom-auth-button {
        border-width: 2px;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .custom-auth-button,
    .custom-auth-field input,
    .spinner {
        transition: none !important;
        animation: none !important;
    }
    
    .spinner {
        animation: none !important;
    }
}

/* Container and Layout */
.custom-auth-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
}

.custom-auth-form-wrapper {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.custom-auth-title {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 24px;
    font-weight: 600;
}

.custom-auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.custom-auth-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.custom-auth-field label {
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.custom-auth-field input {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.custom-auth-field input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0,124,186,0.2);
}

.custom-auth-button {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.custom-auth-button-primary {
    background: #007cba;
    color: white;
}

.custom-auth-button-primary:hover {
    background: #005a87;
}

.custom-auth-divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.custom-auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #ddd;
}

.custom-auth-divider span {
    background: #fff;
    padding: 0 15px;
    color: #666;
    font-size: 14px;
}

.custom-auth-links {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
}

.custom-auth-links a {
    color: #007cba;
    text-decoration: none;
}

.custom-auth-links a:hover {
    text-decoration: underline;
}

.custom-auth-links .separator {
    margin: 0 10px;
    color: #ddd;
}

.custom-auth-message {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 14px;
}

.custom-auth-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.custom-auth-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

#custom-auth-login,
#custom-auth-register,
#custom-auth-reset,
#custom-auth-verify {
    padding: 20px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin: 20px 0;
    text-align: center;
}

/* Google Auth Button Styles */
.custom-auth-button-google {
    background: #fff !important;
    color: #757575 !important;
    border: 1px solid #ddd !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    font-weight: 500 !important;
    transition: all 0.3s ease !important;
    cursor: pointer !important;
    padding: 12px 24px !important;
    border-radius: 4px !important;
    font-size: 14px !important;
    text-decoration: none !important;
    width: 100% !important;
    margin: 10px 0 !important;
}

.custom-auth-button-google:hover {
    background: #f8f9fa !important;
    border-color: #dadce0 !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12) !important;
}

.custom-auth-button-google:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
}

.google-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Spinner for loading state */
.spinner {
    animation: spin 1s linear infinite;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    display: inline-block;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* User Info Styles */
.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 20px 0;
}

.user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.default-avatar {
    width: 100%;
    height: 100%;
    background: #007cba;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
}

.user-details {
    flex: 1;
}

.user-details h3 {
    margin: 0 0 5px 0;
    font-size: 18px;
    color: #333;
}

.user-details p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* Alert Styles */
.alert {
    padding: 12px 16px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

/* Loading State */
.custom-auth-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Password Strength Meter Accessibility */
.password-strength-meter {
    margin-top: 8px;
}

.strength-bar {
    height: 4px;
    background: #eee;
    border-radius: 2px;
    overflow: hidden;
}

.strength-progress {
    height: 100%;
    background: #ddd;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.strength-text {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
    display: block;
}

/* Password Requirements List */
.password-requirements {
    margin: 8px 0 0 0;
    padding: 0;
    list-style: none;
    font-size: 12px;
    color: #666;
}

.password-requirements li {
    margin-bottom: 4px;
    padding-left: 16px;
    position: relative;
}

.password-requirements li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: #ccc;
}

.password-requirements li.valid::before {
    content: '✓';
    color: #28a745;
}

.password-requirements li.invalid::before {
    content: '✗';
    color: #dc3545;
}

/* Field Hints and Errors */
.custom-auth-field-hint {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

.custom-auth-field-error {
    font-size: 12px;
    color: #dc3545;
    margin-top: 4px;
}

/* Fieldset reset for checkboxes */
.custom-auth-checkbox fieldset,
.custom-auth-field.custom-auth-checkbox fieldset {
    border: none !important;
    margin: 0;
    padding: 0;
    min-width: 0;
}

/* Remove default fieldset border for all fieldsets inside custom-auth */
.custom-auth-form fieldset {
    border: none !important;
    margin: 0;
    padding: 0;
    min-width: 0;
}

/* Checkbox label styling */
.custom-auth-checkbox label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 15px;
    line-height: 1.6;
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
}

.custom-auth-checkbox input[type="checkbox"] {
    margin: 0 0 0 8px;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    accent-color: #007cba;
    border-radius: 4px;
    border: 1px solid #bbb;
    background: #fff;
    transition: border-color 0.2s;
}

.custom-auth-checkbox input[type="checkbox"]:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
    border-color: #007cba;
}

/* Remove extra border from checkbox fields */
.custom-auth-field.custom-auth-checkbox {
    border: none !important;
    background: none !important;
    box-shadow: none !important;
    padding: 0;
    margin-bottom: 10px;
}

/* Remove extra margin from last checkbox */
.custom-auth-field.custom-auth-checkbox:last-child {
    margin-bottom: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .user-info {
        flex-direction: column;
        text-align: center;
    }
    
    .user-avatar {
        margin-bottom: 10px;
    }
    
    .custom-auth-container {
        padding: 10px;
    }
    
    .custom-auth-form-wrapper {
        padding: 20px;
    }
}

/* High Contrast and Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .custom-auth-form-wrapper {
        background: #2d2d2d;
        border-color: #444;
        color: #fff;
    }
    
    .custom-auth-title {
        color: #fff;
    }
    
    .custom-auth-field label {
        color: #fff;
    }
    
    .custom-auth-field input {
        background: #3d3d3d;
        border-color: #555;
        color: #fff;
    }
    
    .custom-auth-field input::placeholder {
        color: #aaa;
    }
}
