/**
 * Authentication Pages Styles
 * Used for: Login, Registration, Forgot Password, Reset Password
 */

:root {
    --auth-primary: #2563eb;
    --auth-primary-hover: #1d4ed8;
    --auth-primary-light: #eff6ff;
    --auth-success: #22c55e;
    --auth-success-light: #f0fdf4;
    --auth-error: #ef4444;
    --auth-error-light: #fef2f2;
    --auth-text-primary: #0f172a;
    --auth-text-secondary: #64748b;
    --auth-text-muted: #94a3b8;
    --auth-border: #e2e8f0;
    --auth-bg: #ffffff;
    --auth-bg-secondary: #f8fafc;
    --auth-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --auth-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

/* Container */
.auth-container {
    padding: 0 0 80px;
    min-height: calc(100vh - 200px);
    position: relative;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

/* Card */
.auth-card {
    background: var(--auth-bg);
    border-radius: 24px;
    padding: 48px;
    box-shadow: var(--auth-shadow-lg);
    border: 1px solid var(--auth-border);
    animation: fadeInUp 0.6s ease-out;
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.auth-card:hover::before {
    opacity: 1;
}

/* Header */
.auth-header {
    margin-bottom: 40px;
    animation: fadeIn 0.6s ease-out 0.1s both;
}

.auth-title {
    font-family: 'Bricolage Grotesque', system-ui, sans-serif;
    font-size: 32px;
    font-weight: 700;
    color: var(--auth-text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.auth-subtitle {
    font-family: 'General Sans', system-ui, sans-serif;
    font-size: 16px;
    color: var(--auth-text-secondary);
    margin: 0;
    font-weight: 400;
}

/* Alerts */
.alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 14px;
    font-weight: 500;
    animation: slideDown 0.3s ease-out;
}

.alert-success {
    background: var(--auth-success-light);
    color: var(--auth-success);
    border: 1px solid #bbf7d0;
}

.alert-error {
    background: var(--auth-error-light);
    color: var(--auth-error);
    border: 1px solid #fecaca;
}

.alert-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Form */
.auth-form {
    animation: fadeIn 0.6s ease-out 0.2s both;
}

.form-group {
    margin-bottom: 28px;
}

/* Input Wrapper */
.input-wrapper {
    position: relative;
}

.form-input {
    width: 100%;
    padding: 16px 16px;
    font-size: 15px;
    font-family: 'General Sans', system-ui, sans-serif;
    border: 2px solid var(--auth-border);
    border-radius: 12px;
    background: var(--auth-bg);
    color: var(--auth-text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.form-input:focus {
    border-color: var(--auth-primary);
    background: var(--auth-bg);
}

.form-input:focus ~ .input-border {
    transform: scaleX(1);
}

.form-input:not(:placeholder-shown) ~ .form-label,
.form-input:focus ~ .form-label {
    transform: translateY(-28px) scale(0.875);
    color: var(--auth-primary);
    font-weight: 500;
}

.input-border {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
    transform: scaleX(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 0 0 12px 12px;
}

/* Floating Label */
.form-label {
    position: absolute;
    left: 16px;
    top: 17px;
    font-size: 15px;
    font-family: 'General Sans', system-ui, sans-serif;
    color: var(--auth-text-muted);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: left top;
    background: var(--auth-bg);
    padding: 0 4px;
}

/* Password Toggle */
.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--auth-text-muted);
    transition: all 0.2s ease;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle:hover {
    background: var(--auth-bg-secondary);
    color: var(--auth-text-secondary);
}

.eye-icon,
.eye-slash-icon {
    width: 20px;
    height: 20px;
}

.hidden {
    display: none;
}

/* Input Error State */
.input-error {
    border-color: var(--auth-error) !important;
}

.input-error:focus {
    border-color: var(--auth-error) !important;
}

.input-error ~ .input-border {
    background: var(--auth-error);
}

.input-error-message {
    color: var(--auth-error);
    font-size: 13px;
    margin-top: 6px;
    margin-left: 4px;
    font-weight: 500;
    animation: shake 0.3s ease;
}

/* Form Row */
.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 12px;
}

/* Checkbox */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.checkbox-wrapper input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--auth-border);
    border-radius: 6px;
    position: relative;
    transition: all 0.2s ease;
    background: var(--auth-bg);
}

.checkbox-wrapper input[type="checkbox"]:checked ~ .checkbox-custom {
    background: var(--auth-primary);
    border-color: var(--auth-primary);
}

.checkbox-wrapper input[type="checkbox"]:checked ~ .checkbox-custom::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-label {
    font-size: 14px;
    color: var(--auth-text-secondary);
    font-weight: 500;
}

/* Forgot Link */
.forgot-link {
    font-size: 14px;
    color: var(--auth-primary);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.forgot-link:hover {
    color: var(--auth-primary-hover);
    text-decoration: underline;
}

/* Submit Button */
.btn-submit {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    font-family: 'General Sans', system-ui, sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-submit::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.btn-submit:hover::before {
    left: 100%;
}

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

.btn-submit.loading .btn-text,
.btn-submit.loading .btn-icon {
    opacity: 0;
}

.btn-submit.loading .btn-loader {
    display: block;
}

.btn-icon {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.btn-submit:hover .btn-icon {
    transform: translateX(4px);
}

.btn-loader {
    position: absolute;
}

.spinner {
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

.spinner-circle {
    stroke-dasharray: 50;
    stroke-dashoffset: 25;
}

/* Divider */
.divider {
    position: relative;
    text-align: center;
    margin: 32px 0;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--auth-border);
}

.divider-text {
    position: relative;
    display: inline-block;
    background: var(--auth-bg);
    padding: 0 16px;
    font-size: 14px;
    color: var(--auth-text-muted);
    font-weight: 500;
}

/* Google Button */
.btn-google {
    width: 100%;
    padding: 14px 24px;
    background: var(--auth-bg);
    border: 2px solid var(--auth-border);
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    font-family: 'General Sans', system-ui, sans-serif;
    color: var(--auth-text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-google:hover {
    background: var(--auth-bg-secondary);
    border-color: var(--auth-text-muted);
    transform: translateY(-1px);
    box-shadow: var(--auth-shadow);
}

.google-icon {
    width: 20px;
    height: 20px;
}

/* Auth Footer */
.auth-footer {
    text-align: center;
    margin-top: 32px;
    font-size: 14px;
    color: var(--auth-text-secondary);
}

.signup-link {
    color: var(--auth-primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.signup-link:hover {
    color: var(--auth-primary-hover);
    text-decoration: underline;
}

/* Illustration */
.auth-illustration {
    animation: fadeIn 0.8s ease-out 0.3s both;
}

.auth-illustration img {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.1));
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

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

/* RTL Support */
[dir="rtl"] .form-input,
[dir="rtl"] textarea.form-input {
    text-align: right;
}

[dir="rtl"] .form-label {
    right: 16px;
    left: auto;
    transform-origin: right top;
}

[dir="rtl"] .form-input:not(:placeholder-shown) ~ .form-label,
[dir="rtl"] .form-input:focus ~ .form-label {
    transform: translateY(-28px) scale(0.875);
}

[dir="rtl"] .password-toggle {
    right: auto;
    left: 12px;
}

[dir="rtl"] .checkbox-wrapper {
    flex-direction: row-reverse;
}

[dir="rtl"] .checkbox-label {
    margin-right: 10px;
    margin-left: 0;
}

[dir="rtl"] .btn-icon {
    transform: scaleX(-1);
}

[dir="rtl"] .btn-submit:hover .btn-icon {
    transform: scaleX(-1) translateX(-4px);
}

[dir="rtl"] .google-icon {
    margin-left: 0;
    margin-right: 12px;
}

/* Smaller Container for Auth Pages ONLY */
.auth-container .container--lg {
    max-width: 1500px !important;
}

/* Responsive */
@media (max-width: 768px) {
    .auth-card {
        padding: 32px 24px;
    }

    .auth-title {
        font-size: 28px;
    }

    .form-row {
        flex-direction: column;
        align-items: flex-start;
    }

    [dir="rtl"] .form-row {
        align-items: flex-end;
    }
}
