/* Authentication Page Styles */
/* Login, Register, Forgot Password pages */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background-color: var(--color-gray-50);
}

.dark .auth-page {
    background-color: var(--color-gray-900);
}

/* Main Container */
.login-container {
    width: 100%;
    max-width: 28rem;
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 2rem;
    margin: auto;
}

.dark .login-container {
    background-color: var(--color-gray-800);
}

@media (min-width: 640px) {
    .login-container {
        padding: 3rem;
    }
}

/* Header Section */
.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4rem;
    height: 4rem;
    margin-bottom: 1rem;
    background-color: var(--color-primary);
    border-radius: var(--radius-xl);
    font-size: 2rem;
    color: white;
}

.auth-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: var(--radius-xl);
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-gray-700);
    margin-bottom: 0.5rem;
}

.dark .login-header h1 {
    color: var(--color-gray-200);
}

.login-header p {
    font-size: 0.875rem;
    color: var(--color-gray-400);
}

/* Alert Messages */
.alert {
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    animation: slideDown 0.3s ease-out;
}

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

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.dark .alert-error {
    background-color: rgba(220, 38, 38, 0.2);
    color: #fca5a5;
    border-color: rgba(220, 38, 38, 0.3);
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.dark .alert-success {
    background-color: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
    border-color: rgba(16, 185, 129, 0.3);
}

.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.dark .alert-warning {
    background-color: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
    border-color: rgba(245, 158, 11, 0.3);
}

/* Form Groups */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-gray-700);
    margin-bottom: 0.375rem;
}

.dark .form-group label {
    color: var(--color-gray-400);
}

.form-group input.error {
    border-color: var(--color-error);
}

.form-group input.error:focus {
    border-color: var(--color-error);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.required {
    color: var(--color-error);
}

/* Error Messages */
.error-message {
    display: block;
    margin-top: 0.375rem;
    font-size: 0.75rem;
    color: var(--color-error);
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.2s ease-in-out;
}

.error-message.show {
    opacity: 1;
    max-height: 3rem;
}

/* Form Help Text */
.form-help {
    display: block;
    margin-top: 0.375rem;
    font-size: 0.75rem;
    color: var(--color-gray-500);
}

/* Password Toggle */
.password-group {
    position: relative;
    display: flex;
    align-items: center;
}

.password-group input {
    padding-right: 2.5rem;
}

.password-toggle {
    position: absolute;
    right: 0.5rem;
    background: none;
    border: none;
    padding: 0.25rem;
    color: var(--color-gray-400);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.15s ease-in-out;
}

.password-toggle:hover {
    color: var(--color-gray-600);
}

.dark .password-toggle:hover {
    color: var(--color-gray-300);
}

/* Form Options (Remember Me, Forgot Password) */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.remember-me input {
    margin: 0;
}

.remember-me label {
    margin: 0;
    font-weight: normal;
    color: var(--color-gray-700);
    cursor: pointer;
}

.dark .remember-me label {
    color: var(--color-gray-400);
}

.forgot-password {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-primary);
    text-decoration: none;
}

.forgot-password:hover {
    color: var(--color-primary-dark);
}

.dark .forgot-password {
    color: var(--color-primary-light);
}

.dark .forgot-password:hover {
    color: var(--color-primary);
}

/* Submit Button */
.btn-login {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: white;
    background-color: var(--color-primary);
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    transition: all 0.15s ease-in-out;
    min-height: 2.5rem;
}

.btn-login:hover:not(:disabled) {
    background-color: var(--color-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-login:active:not(:disabled) {
    background-color: var(--color-primary-dark);
    transform: translateY(0);
}

.btn-login:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    margin-right: 0.5rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Divider */
hr {
    margin: 1.5rem 0;
    border: 0;
    border-top: 1px solid var(--color-gray-200);
}

.dark hr {
    border-top-color: var(--color-gray-600);
}

/* Footer Links */
.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-gray-200);
    font-size: 0.875rem;
}

.dark .login-footer {
    border-top-color: var(--color-gray-600);
}

.auth-footer-text {
    color: var(--color-gray-600);
    margin-bottom: 0.5rem;
}

.dark .auth-footer-text {
    color: var(--color-gray-400);
}

.login-footer a {
    font-weight: 500;
    color: var(--color-primary);
}

.login-footer a:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

.dark .login-footer a {
    color: var(--color-primary-light);
}

.dark .login-footer a:hover {
    color: var(--color-primary);
}

/* Social Login Buttons (if needed) */
.btn-social {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.625rem 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-gray-700);
    background-color: white;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-lg);
    transition: all 0.15s ease-in-out;
}

.btn-social:hover {
    background-color: var(--color-gray-50);
    border-color: var(--color-gray-500);
}

.dark .btn-social {
    color: var(--color-gray-400);
    background-color: transparent;
    border-color: var(--color-gray-600);
}

.dark .btn-social:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: var(--color-gray-500);
}

.btn-social svg {
    width: 1rem;
    height: 1rem;
    margin-right: 0.5rem;
}

/* Responsive Design */
@media (max-width: 640px) {
    .auth-page {
        padding: 1rem;
    }

    .login-container {
        padding: 1.5rem;
    }

    .login-header h1 {
        font-size: 1.25rem;
    }

    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

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

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Alpine.js cloak */
[x-cloak] {
    display: none !important;
}
