/**
 * Modern Login Page Styles
 * استایل‌های صفحه لاگین مدرن
 */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #ecf2ff 0%, #f5f0ff 100%);
    padding: 2.5vh 1rem;
    padding-bottom: 2rem;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
}

.login-page::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 15% 20%, rgba(147, 197, 253, 0.45) 0, transparent 55%),
        radial-gradient(circle at 80% 10%, rgba(221, 214, 254, 0.45) 0, transparent 50%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.55), rgba(245, 247, 255, 0.85));
    opacity: 0.9;
}

.login-page::after {
    content: "";
    position: absolute;
    inset: 0;
    background: url('data:image/svg+xml,<svg width="160" height="160" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient id="l" x1="0%" y1="0%" x2="100%" y2="100%"><stop offset="0%" stop-color="rgba(37,99,235,0.12)"/><stop offset="100%" stop-color="rgba(147,51,234,0.08)"/></linearGradient></defs><path d="M80 0 L160 80 L80 160 L0 80 Z" fill="url(%23l)" fill-opacity="0.35"/></svg>') repeat;
    opacity: 0.18;
    mix-blend-mode: soft-light;
}

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 380px;
}

.login-card {
    background: #ffffff;
    border: 1px solid rgba(37, 99, 235, 0.08);
    border-radius: 1.25rem;
    box-shadow: 0 28px 60px -25px rgba(30, 64, 175, 0.35);
    padding: 1.55rem 1.55rem;
    animation: slideUp 0.45s ease-out;
    font-family: 'IRANSans', 'Tahoma', sans-serif;
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: "";
    position: absolute;
    inset: -60px auto auto -60px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(147, 197, 253, 0.35) 0%, transparent 65%);
    opacity: 0.85;
}

.login-card::after {
    content: "";
    position: absolute;
    inset: auto -70px -70px auto;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(221, 214, 254, 0.4) 0%, transparent 70%);
    opacity: 0.8;
}

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

/* Brand Heading */
/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.login-heading {
    text-align: center;
    margin-bottom: 1.15rem;
}

.login-brand-title {
    font-size: clamp(0.9rem, 1.6vw, 1.1rem);
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 0.4rem;
    letter-spacing: -0.01em;
}

.login-brand-subtitle {
    font-size: clamp(0.72rem, 1.6vw, 0.88rem);
    color: #475569;
    margin: 0;
    line-height: 1.7;
}

.login-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-logo {
    width: 60px;
    height: 60px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, #2563eb 0%, #9333ea 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 14px 28px rgba(59, 130, 246, 0.28);
}

.login-logo svg {
    width: 30px;
    height: 30px;
    color: #fff;
}

.login-title {
    font-size: clamp(0.82rem, 1.5vw, 1rem);
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.25rem;
    line-height: 1.3;
    font-family: 'IRANSans', 'Tahoma', sans-serif;
}

.login-subtitle {
    font-size: clamp(0.68rem, 1.5vw, 0.8rem);
    color: #64748b;
    line-height: 1.4;
    font-family: 'IRANSans', 'Tahoma', sans-serif;
}

.login-form {
    margin-top: 1.1rem;
}

.form-group {
    margin-bottom: 1.05rem;
    position: relative;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: clamp(0.72rem, 1.4vw, 0.82rem);
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.375rem;
    line-height: 1.4;
    font-family: 'IRANSans', 'Tahoma', sans-serif;
}

.form-label svg {
    width: 16px;
    height: 16px;
    color: #2563eb;
    flex-shrink: 0;
}

.form-input-wrapper {
    position: relative;
}

.form-input {
    width: 100%;
    padding: 0.75rem 2.75rem 0.75rem 0.875rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 0.625rem;
    font-size: clamp(1rem, 2vw, 1.2rem);
    transition: all 0.3s ease;
    background: #fff;
    color: #1f2937;
    font-family: 'IRANSans', 'Tahoma', sans-serif;
    line-height: 1.5;
    box-sizing: border-box;
}

.form-input::placeholder {
    font-size: clamp(0.75rem, 1.5vw, 0.85rem);
    color: #9ca3af;
}

.form-input:focus {
    outline: none;
    border-color: rgba(37, 99, 235, 0.8);
    box-shadow: 0 12px 24px -18px rgba(37, 99, 235, 0.45);
}

.form-input-icon {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: #9ca3af;
    pointer-events: none;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-input:focus + .form-input-icon {
    color: #2563eb;
}

.password-toggle {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.375rem;
    color: #9ca3af;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle:hover {
    color: #2563eb;
}

.password-toggle svg {
    width: 18px;
    height: 18px;
}

.captcha-group {
    margin-bottom: 1.05rem;
}

.captcha-wrapper {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.captcha-image {
    position: relative;
    flex: 0 0 auto;
    border: 1.5px solid rgba(148, 163, 184, 0.3);
    border-radius: 0.65rem;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(226, 232, 255, 0.65), rgba(248, 250, 255, 0.95));
    cursor: pointer;
    transition: all 0.35s ease;
    padding: 0.25rem 0.5rem;
    max-width: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.captcha-image::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 20%, rgba(147, 197, 253, 0.25), transparent 60%);
    opacity: 0;
    transition: opacity 0.35s ease;
}

.captcha-image:hover {
    border-color: rgba(37, 99, 235, 0.85);
    box-shadow: 0 18px 32px -20px rgba(37, 99, 235, 0.35);
}

.captcha-image:hover::after {
    opacity: 1;
}

.captcha-image img {
    display: block;
    width: 105px;
    height: 36px;
    object-fit: contain;
    mix-blend-mode: multiply;
    filter: contrast(110%);
}

.captcha-input-wrapper {
    flex: 1;
}

.captcha-input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 0.55rem;
    font-size: clamp(1rem, 2vw, 1.2rem);
    transition: all 0.3s ease;
    background: #fff;
    color: #0f172a;
    font-family: 'IRANSans', 'Tahoma', sans-serif;
    text-align: center;
    letter-spacing: 0.24rem;
    font-weight: 600;
    line-height: 1.5;
    box-sizing: border-box;
}

.captcha-input::placeholder {
    font-size: clamp(0.75rem, 1.5vw, 0.85rem);
    color: #9ca3af;
    letter-spacing: normal;
    font-weight: normal;
}

.captcha-input:focus {
    outline: none;
    border-color: rgba(37, 99, 235, 0.85);
    box-shadow: 0 16px 28px -20px rgba(37, 99, 235, 0.35);
}

.captcha-refresh {
    background: linear-gradient(135deg, rgba(226, 232, 255, 0.7), rgba(255, 255, 255, 0.9));
    border: 1.5px solid #e2e8f0;
    border-radius: 0.625rem;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2563eb;
    flex-shrink: 0;
}

.captcha-refresh:hover {
    background: linear-gradient(135deg, #2563eb 0%, #9333ea 100%);
    border-color: transparent;
    color: #ffffff;
    box-shadow: 0 16px 30px -18px rgba(59, 130, 246, 0.4);
}

.captcha-refresh svg {
    width: 18px;
    height: 18px;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.1rem;
    cursor: pointer;
    user-select: none;
}

.remember-me input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #2563eb;
    flex-shrink: 0;
}

.remember-me label {
    font-size: clamp(0.7rem, 1.4vw, 0.8rem);
    color: #64748b;
    cursor: pointer;
    margin: 0;
    line-height: 1.4;
    font-family: 'IRANSans', 'Tahoma', sans-serif;
}

.login-button {
    width: 100%;
    padding: 0.7rem 0.85rem;
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    color: #fff;
    border: none;
    border-radius: 0.55rem;
    font-size: clamp(0.76rem, 1.5vw, 0.88rem);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-direction: row;
    direction: ltr;
    box-shadow: 0 18px 32px -18px rgba(59, 130, 246, 0.5);
    font-family: 'IRANSans', 'Tahoma', sans-serif;
    line-height: 1.5;
}

.login-button svg {
    transform: scaleX(-1);
}

.login-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 36px -16px rgba(124, 58, 237, 0.45);
}

.login-button:active {
    transform: translateY(0);
}

.login-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.login-button svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.error-message {
    background: rgba(254, 226, 226, 0.8);
    border: 1px solid rgba(248, 113, 113, 0.35);
    color: #b91c1c;
    padding: 0.75rem 2.5rem 0.75rem 0.875rem;
    border-radius: 0.625rem;
    margin-bottom: 1.25rem;
    font-size: clamp(0.7rem, 1.4vw, 0.8rem);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    line-height: 1.4;
    font-family: 'IRANSans', 'Tahoma', sans-serif;
    position: relative;
}

.error-close {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(185, 28, 28, 0.12);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: all 0.2s ease;
    color: #b91c1c;
    flex-shrink: 0;
}

.error-close:hover {
    background: rgba(185, 28, 28, 0.22);
    transform: translateY(-50%) scale(1.1);
}

.error-close:active {
    transform: translateY(-50%) scale(0.95);
}

.error-close svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.error-message svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.login-footer {
    text-align: center;
    margin-top: 1.1rem;
    padding-top: 1.1rem;
    padding-bottom: 1rem;
    margin-bottom: 0.5rem;
    border-top: 1px solid rgba(226, 232, 240, 0.6);
    position: relative;
}

.login-footer a {
    color: #2563eb;
    text-decoration: none;
    font-size: clamp(0.72rem, 1.4vw, 0.8rem);
    transition: color 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    line-height: 1.4;
    font-family: 'IRANSans', 'Tahoma', sans-serif;
}

.login-footer a:hover {
    color: #9333ea;
    text-decoration: underline;
}

.login-footer a svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Field error styling */
.field-error {
    color: #dc2626;
    font-size: 0.75rem;
    margin-top: 0.375rem;
    display: block;
    line-height: 1.4;
    font-family: 'IRANSans', 'Tahoma', sans-serif;
}

.form-input.error,
.captcha-input.error {
    border-color: #dc2626;
}

.form-input.error:focus,
.captcha-input.error:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.1);
}

/* Responsive */
@media (max-width: 576px) {
    .login-page {
        padding: 1rem;
        padding-bottom: 3rem;
        align-items: center;
        justify-content: center;
        padding-top: 2rem;
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }
    
    .login-container {
        max-width: 100%;
        margin: auto;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        flex: 1;
    }
    
    .login-card {
        padding: 1.45rem 1.35rem;
        padding-bottom: 2rem;
        border-radius: 0.875rem;
        margin: auto;
        width: 100%;
        box-sizing: border-box;
        max-width: 100%;
    }
    
    .login-footer {
        padding-bottom: 2.5rem;
        margin-bottom: 1.5rem;
    }
    
    .login-title {
        font-size: 1.375rem;
    }
    
    .login-subtitle {
        font-size: 0.75rem;
    }
    
    .form-group {
        margin-bottom: 1.125rem;
    }
    
    .captcha-wrapper {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .captcha-image {
        align-self: center;
        max-width: 170px;
        width: 100%;
        padding: 0.25rem 0.45rem;
    }
    
    .captcha-image img {
        width: 100%;
        height: auto;
    }
}

/* Loading state */
.login-button.loading {
    position: relative;
    pointer-events: none;
    cursor: not-allowed;
}

.login-button.loading span,
.login-button.loading svg {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.login-button.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 1;
}

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

