/* Modern Login 2026 - Glass Morphism Design */

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --accent-color: #a78bfa;
    --text-dark: #1e293b;
    --text-light: #64748b;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --shadow-glass: 0 8px 32px rgba(31, 38, 135, 0.15);
    --shadow-xl: 0 20px 60px rgba(102, 126, 234, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.login-body {
    min-height: 100vh;
    font-family: 'IRANSans', system-ui, -apple-system, sans-serif;
    overflow-x: hidden;
    position: relative;
}

/* Animated Gradient Background */
.background-animation {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #667eea 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Floating Orbs */
.background-animation::before,
.background-animation::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 20s ease-in-out infinite;
}

.background-animation::before {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(167, 139, 250, 0.6) 0%, transparent 70%);
    top: -10%;
    right: -10%;
    animation-delay: 0s;
}

.background-animation::after {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.6) 0%, transparent 70%);
    bottom: -10%;
    left: -10%;
    animation-delay: 5s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -30px) rotate(120deg); }
    66% { transform: translate(-30px, 30px) rotate(240deg); }
}

/* Main Container */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
}

/* Glass Card */
.login-wrapper {
    max-width: 1100px;
    width: 100%;
    display: grid;
    grid-template-columns: 0.9fr 1.1fr;
    gap: 0;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.2),
                0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    overflow: hidden;
    animation: cardFadeIn 0.6s ease-out;
}

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

/* Left Side - Branding */
.login-branding {
    padding: 3rem 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
    position: relative;
    overflow: hidden;
}

.login-branding::before {
    content: '';
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
}

.brand-content {
    position: relative;
    z-index: 1;
}

.logo-container {
    text-align: center;
    margin-bottom: 2.5rem;
}

.logo-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: iconPulse 3s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); }
}

.logo-icon i {
    font-size: 2.5rem;
    color: white;
}

.brand-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.brand-subtitle {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
    margin-bottom: 2rem;
}

.features-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    transition: all 0.3s ease;
}

.feature-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(-5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.feature-item i {
    font-size: 1.5rem;
    opacity: 0.9;
}

.feature-item span {
    font-size: 0.95rem;
    font-weight: 500;
}

/* Right Side - Form */
.login-form-container {
    padding: 3rem 2.5rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-form-wrapper {
    width: 100%;
    max-width: 420px;
}

.form-header {
    text-align: center;
    margin-bottom: 2rem;
}

.welcome-text {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.login-description {
    font-size: 0.95rem;
    color: var(--text-light);
}

/* Alerts */
.alert {
    padding: 0.875rem 1rem;
    border-radius: 12px;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    border: none;
    animation: alertSlide 0.3s ease-out;
}

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

.alert-danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
}

.alert-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
}

.alert i {
    font-size: 1.1rem;
}

.btn-close {
    margin-right: auto;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.btn-close:hover {
    opacity: 1;
}

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

.form-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.form-label i {
    font-size: 1rem;
    color: var(--primary-color);
}

.login-field {
    position: relative;
    display: block;
    width: 100%;
}

.login-field .form-control {
    display: block;
    width: 100%;
    max-width: 100%;
    height: 3rem;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    color: var(--text-dark);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-family: inherit;
    box-sizing: border-box;
}

.login-field.has-toggle .form-control {
    padding-left: 3rem;
}

.login-field .form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.login-field .form-control::placeholder {
    color: #94a3b8;
}

.password-toggle {
    position: absolute;
    left: 0.35rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 10px;
    color: #64748b;
    cursor: pointer;
    line-height: 1;
}

.password-toggle i {
    font-size: 1.15rem;
    pointer-events: none;
}

.password-toggle:hover,
.password-toggle:focus-visible {
    background: #f1f5f9;
    color: var(--primary-color);
    outline: none;
}

.input-focus-border {
    display: none;
}

/* Captcha */
.captcha-container {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.captcha-image {
    background: white;
    border-radius: 12px;
    padding: 0.75rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #e2e8f0;
}

.captcha-image img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.captcha-refresh {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--primary-color);
    color: white;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.captcha-refresh:hover {
    background: var(--secondary-color);
    transform: rotate(180deg);
    color: white;
}

.captcha-input {
    display: block;
    width: 100%;
    height: 3rem;
    padding: 0.75rem 1rem;
    text-align: center;
    letter-spacing: 0.3em;
    font-weight: 600;
    font-size: 1.1rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    color: var(--text-dark);
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.captcha-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

/* Submit Button */
.login-btn {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.login-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.login-btn:hover::before {
    opacity: 1;
}

.login-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.5);
}

.login-btn:active {
    transform: translateY(-1px);
}

.login-btn.loading {
    pointer-events: none;
}

.login-btn.loading .btn-text {
    opacity: 0;
}

.btn-loader {
    position: absolute;
    opacity: 0;
    transition: opacity 0.3s;
}

.login-btn.loading .btn-loader {
    opacity: 1;
    animation: spin 1s linear infinite;
}

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

/* Help Text */
.login-help-text {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-light);
    margin-top: 1rem;
}

/* Footer */
.login-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.footer-text {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-light);
}

.footer-text i {
    color: var(--primary-color);
}

/* Keyboard Alert */
.keyboard-alert {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(239, 68, 68, 0.3);
    display: none;
    align-items: center;
    gap: 0.75rem;
    animation: alertBounce 0.5s ease-out;
}

.keyboard-alert.show {
    display: flex;
}

@keyframes alertBounce {
    0% { transform: translate(-50%, -20px); opacity: 0; }
    50% { transform: translate(-50%, 5px); }
    100% { transform: translate(-50%, 0); opacity: 1; }
}

/* Error States */
.form-error-msg {
    display: none;
    color: #dc2626;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    animation: shake 0.3s;
}

.form-error-msg.show {
    display: block;
}

.form-control.is-invalid {
    border-color: #dc2626;
    animation: shake 0.3s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

.input-blocked {
    animation: shake 0.3s ease-in-out;
    border-color: #dc2626 !important;
}

/* Skip Link */
.skip-link {
    position: absolute;
    top: -48px;
    right: 0;
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0 0 8px 8px;
    text-decoration: none;
    font-weight: 600;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid var(--accent-color);
    color: white;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(102, 126, 234, 0.1);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.4s ease;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.loading-content {
    background: white;
    padding: 2.5rem 3rem;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(31, 38, 135, 0.3);
}

.loading-spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 1.5rem;
    border: 4px solid #e2e8f0;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-content p {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .login-wrapper {
        grid-template-columns: 1fr;
        max-width: 500px;
    }

    .login-branding {
        padding: 2rem 1.5rem;
    }

    .features-list {
        display: none;
    }

    .logo-icon {
        width: 60px;
        height: 60px;
    }

    .logo-icon i {
        font-size: 2rem;
    }

    .brand-title {
        font-size: 1.5rem;
    }

    .brand-subtitle {
        font-size: 0.9rem;
        margin-bottom: 0;
    }
}

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

    .login-wrapper {
        border-radius: 16px;
    }

    .login-form-container {
        padding: 2rem 1.5rem;
    }

    .welcome-text {
        font-size: 1.75rem;
    }

    .form-group {
        margin-bottom: 1.25rem;
    }

    .login-field .form-control {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .login-field.has-toggle .form-control {
        padding-left: 3rem;
    }

    .login-btn {
        padding: 0.875rem;
    }

    .captcha-container {
        padding: 1rem;
    }
}

@media (max-height: 800px) {
    .login-container {
        padding: 1rem;
        align-items: flex-start;
    }

    .login-branding {
        padding: 1.5rem;
    }

    .logo-container {
        margin-bottom: 1rem;
    }

    .form-header {
        margin-bottom: 1.5rem;
    }

    .form-group {
        margin-bottom: 1rem;
    }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    .login-form-container {
        background: rgba(15, 23, 42, 0.9);
    }

    .welcome-text {
        color: white;
    }

    .login-description,
    .form-label,
    .footer-text {
        color: #cbd5e1;
    }

    .login-field .form-control,
    .captcha-input {
        background: rgba(255, 255, 255, 0.05);
        border-color: rgba(255, 255, 255, 0.1);
        color: white;
    }

    .login-field .form-control::placeholder,
    .captcha-input::placeholder {
        color: #64748b;
    }

    .captcha-container {
        background: rgba(255, 255, 255, 0.05);
        border-color: rgba(255, 255, 255, 0.1);
    }

    .captcha-image {
        background: rgba(255, 255, 255, 0.05);
        border-color: rgba(255, 255, 255, 0.1);
    }
}
