/**
 * Authentication Forms CSS - Enhanced styling and responsiveness
 * Includes password visibility controls, form validation states, and responsive design
 */

/* Password visibility toggle styles */
.password-eye {
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    color: #6c757d;
    transition: all 0.2s ease;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 18px 18px;
    /* Default state: Eye icon (password hidden) */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%236c757d'%3e%3cpath d='M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17M12,4.5C7,4.5 2.73,7.61 1,12C2.73,16.39 7,19.5 12,19.5C17,19.5 21.27,16.39 23,12C21.27,7.61 17,4.5 12,4.5Z' /%3e%3c/svg%3e");
}

.password-eye:hover {
    opacity: 0.8;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

/* Eye-off icon (password visible) */
.show-password .password-eye {
    color: #007bff;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23007bff'%3e%3cpath d='M11.83,9L15,12.16C15,12.11 15,12.05 15,12A3,3 0 0,0 12,9C11.94,9 11.89,9 11.83,9M7.53,9.8L9.08,11.35C9.03,11.56 9,11.77 9,12A3,3 0 0,0 12,15C12.22,15 12.44,14.97 12.65,14.92L14.2,16.47C13.53,16.8 12.79,17 12,17A5,5 0 0,1 7,12C7,11.21 7.2,10.47 7.53,9.8M2,4.27L4.28,6.55L4.73,7C3.08,8.3 1.78,10 1,12C2.73,16.39 7,19.5 12,19.5C13.55,19.5 15.03,19.2 16.38,18.66L16.81,19.09L19.73,22L21,20.73L3.27,3M12,7A5,5 0 0,1 17,12C17,12.64 16.87,13.26 16.64,13.82L19.57,16.75C21.07,15.5 22.27,13.86 23,12C21.27,7.61 17,4.5 12,4.5C10.6,4.5 9.26,4.75 8,5.2L10.17,7.35C10.76,7.13 11.37,7 12,7Z' /%3e%3c/svg%3e");
}

/* Enhanced form input styling */
.form-control {
    transition: all 0.2s ease;
}

.form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Visual feedback for form groups */
.focused .form-control {
    border-color: #007bff;
}

.has-value .form-label {
    color: #007bff;
    font-weight: 500;
}

/* Form validation states */
.was-validated .form-control:valid {
    border-color: #28a745;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='m2.3 6.73.94-.94 2.94 2.94L8.08 6.84l.94.94-4.72 4.72-2.94-2.94z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.was-validated .form-control:invalid {
    border-color: #dc3545;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 4.6 2.4 2.4m0-2.4L5.8 7'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

/* Loading state for submit buttons */
.btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Enhanced alert styling with animations */
.alert {
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-dismissible .btn-close {
    padding: 0.5rem 0.5rem;
}

/* Auth card responsive enhancements */
@media (max-width: 767.98px) {
    .account-pages {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }

    .card {
        margin: 0 0.5rem;
        border-radius: 12px;
    }

    .card-body {
        padding: 1.5rem;
    }

    .card-header {
        padding: 1.5rem;
    }

    .form-control {
        padding: 0.6rem 0.75rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .btn {
        padding: 0.6rem 1rem;
        font-size: 16px;
    }

    .text-center.w-75.m-auto {
        width: 90% !important;
    }
}

@media (max-width: 575.98px) {
    .account-pages {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .card {
        margin: 0 0.25rem;
    }

    .card-body {
        padding: 1rem;
    }

    .card-header {
        padding: 1rem;
    }

    .card-header img {
        width: 80px;
    }
}

/* Focus indicators for accessibility */
.form-control:focus,
.btn:focus,
.btn-close:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Enhanced hover states */
.btn-primary:hover {
    background-color: #0056b3;
    border-color: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.25);
}

.btn {
    transition: all 0.2s ease;
}

/* Link styling improvements */
a.text-muted:hover {
    color: #007bff !important;
    text-decoration: underline;
}

/* Form label enhancements */
.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #495057;
}

/* Input group styling */
.input-group-text {
    background-color: #f8f9fa;
    border-color: #ced4da;
    transition: all 0.2s ease;
}

.form-control:focus + .input-group-text {
    border-color: #007bff;
    background-color: #e3f2fd;
}

/* Remember me checkbox styling */
.form-check-input:checked {
    background-color: #007bff;
    border-color: #007bff;
}

.form-check-input:focus {
    border-color: #007bff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Loading spinner animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spinner-border {
    animation: spin 0.75s linear infinite;
}

/* Card shadow enhancement */
.card {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* Background pattern overlay */
.authentication-bg .position-absolute svg {
    opacity: 0.1;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .form-control {
        border-width: 2px;
    }

    .btn-primary {
        border-width: 2px;
    }

    .alert {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Password strength indicators */
#password-requirements {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 0.75rem;
}

#password-requirements .row > div {
    margin-bottom: 0.25rem;
}

#password-requirements .row > div:last-child {
    margin-bottom: 0;
}

.progress {
    background-color: #e9ecef;
    border-radius: 2px;
}

.progress-bar {
    transition: width 0.3s ease, background-color 0.3s ease;
}

#password-match-container {
    padding: 0.5rem;
    border-radius: 4px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
}

/* Responsive password requirements */
@media (max-width: 575.98px) {
    #password-requirements .col-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    #password-requirements {
        padding: 0.5rem;
    }

    #password-requirements small {
        font-size: 0.75rem;
    }
}

/* Enhanced icon transitions */
#password-requirements i,
#password-match-indicator i {
    transition: color 0.2s ease;
    font-size: 0.875rem;
}

/* Password strength text transitions */
#password-strength-text {
    transition: color 0.3s ease;
    font-weight: 500;
}

/* Dark mode support (if implemented) */
@media (prefers-color-scheme: dark) {
    .authentication-bg {
        background-color: #1a1a1a;
    }

    .card {
        background-color: #2d2d2d;
        border-color: #404040;
    }

    .form-control {
        background-color: #404040;
        border-color: #555;
        color: #fff;
    }

    .form-control:focus {
        background-color: #404040;
        border-color: #007bff;
        color: #fff;
    }

    .form-label {
        color: #e0e0e0;
    }

    .text-muted {
        color: #aaa !important;
    }

    #password-requirements,
    #password-match-container {
        background-color: #404040;
        border-color: #555;
    }

    .progress {
        background-color: #555;
    }
}
