/* auth.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Times New Roman', serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.auth-container {
    width: 100%;
    max-width: 450px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Logo Section */
.logo-section {
    text-align: center;
    padding: 30px 20px 20px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
}

.logo {
    width: 80px;
    height: 80px;
    margin-bottom: 15px;
}

.app-title {
    font-size: 24px;
    font-weight: bold;
    margin: 0;
}

/* Form Container */
.form-container {
    padding: 30px;
    display: none;
}

.form-container.active {
    display: block;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.form-container h2 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
    font-size: 24px;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 25px;
    font-size: 14px;
}

/* Form Groups */
.form-group {
    margin-bottom: 20px;
    text-align: left;
    position: relative; /* Needed for positioning field errors */
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Times New Roman', serif;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.form-group input:focus {
    outline: none;
    border-color: #007bff;
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* --- ADDED CUSTOM VALIDATION STYLES --- */

/* Success state (e.g., matching password, valid email format) */
.form-group input.password-match-success,
.form-group input:valid:focus:not([type="checkbox"]) { /* Only apply green border if valid and focused/typing */
    border-color: #28a745 !important;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.2);
}

/* Error state */
.form-group input.error,
.form-group input:invalid:not(:placeholder-shown):not([type="checkbox"]) { /* Apply red border if invalid and not empty */
    border-color: #dc3545 !important;
    background-color: #fff5f5 !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.2);
}

.field-error-message {
    color: #dc3545;
    font-size: 12px;
    margin-top: 5px;
    display: block;
    font-weight: 500;
}

.error-message-box { /* Global error message styling */
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 8px;
    margin: 15px 0;
    text-align: center;
    border: 1px solid #f5c6cb;
    font-size: 14px;
    font-weight: bold;
}
/* -------------------------------------- */


/* Password Container */
.password-container {
    position: relative;
}

.password-container input {
    padding-right: 50px;
}

.toggle-password {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #666;
    user-select: none;
    transition: color 0.3s ease;
}

.toggle-password:hover {
    color: #007bff;
}

/* Remember Me */
.remember-me {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.remember-me label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #555;
    margin: 0;
}

.remember-me input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #007bff;
}

/* Buttons */
.btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Times New Roman', serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 123, 255, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary { /* Style for secondary button (e.g., in Success message) */
    background: #6c757d;
    color: white;
}

.btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Form Links */
.form-links {
    margin-top: 25px;
    text-align: center;
}

.form-links p {
    margin: 10px 0;
    color: #666;
    font-size: 14px;
}

.form-links a {
    color: #007bff;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
}

.form-links a:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* Success Message */
.success-icon {
    width: 80px;
    height: 80px;
    background: #28a745;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin: 0 auto 20px;
    animation: bounce 0.6s ease-out;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

#successMessage h2 {
    color: #28a745;
    margin-bottom: 10px;
}

#successMessage p {
    text-align: center;
    color: #666;
    margin-bottom: 25px;
    line-height: 1.5;
}

/* Hidden Utility */
.hidden {
    display: none !important;
}

/* Loading State */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-right-color: transparent;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Error States (Old generic error classes, updated to use :invalid) */
.error {
    border-color: #dc3545 !important;
}

.error-message {
    color: #dc3545;
    font-size: 12px;
    margin-top: 5px;
    display: block;
}

/* Responsive Design */
@media (max-width: 480px) {
    .auth-container {
        margin: 10px;
        border-radius: 10px;
    }
    
    .form-container {
        padding: 25px 20px;
    }
    
    .logo-section {
        padding: 25px 20px 15px;
    }
    
    .logo {
        width: 60px;
        height: 60px;
    }
    
    .app-title {
        font-size: 20px;
    }
    
    .form-container h2 {
        font-size: 20px;
    }
    
    .btn {
        padding: 12px;
        font-size: 14px;
    }
}

/* Enhanced Error/Success Styles (from original code) */
.password-match-success {
    border-color: #28a745 !important;
}

.password-match-error {
    border-color: #dc3545 !important;
}

.suggestion-message {
    background: #d1ecf1;
    color: #0c5460;
    padding: 10px;
    border-radius: 5px;
    margin: 10px 0;
    text-align: center;
    border: 1px solid #bee5eb;
    font-size: 13px;
}

.success-message {
    background: #d4edda;
    color: #155724;
    padding: 12px;
    border-radius: 8px;
    margin: 15px 0;
    text-align: center;
    border: 1px solid #c3e6cb;
    font-size: 14px;
    font-weight: bold;
}

/* Enhanced form group spacing */
.form-group {
    margin-bottom: 20px;
    text-align: left;
    position: relative;
}

/* Loading state improvements */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-right-color: transparent;
    animation: spin 0.8s linear infinite;
}

.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    right: 15px;
}

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

/* Success message enhancements */
.success-message-enhanced {
    background: #d4edda;
    color: #155724;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    text-align: center;
    border: 1px solid #c3e6cb;
    animation: fadeIn 0.5s ease-in;
}

.success-message-enhanced i {
    font-size: 24px;
    margin-bottom: 10px;
    display: block;
}
