.ul-login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px 14px;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 12% 20%, rgba(61, 102, 219, 0.35), transparent 46%),
        radial-gradient(circle at 84% 18%, rgba(17, 175, 117, 0.27), transparent 43%),
        radial-gradient(circle at 72% 84%, rgba(30, 122, 222, 0.2), transparent 40%),
        linear-gradient(158deg, #e6eeff 0%, #dce8ff 48%, #e9f8ef 100%);
    animation: ul-bg-pan 12s ease-in-out infinite alternate;
}

.ul-login-page::before,
.ul-login-page::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    pointer-events: none;
    filter: blur(2px);
}

.ul-login-page::before {
    width: 240px;
    height: 240px;
    right: -70px;
    top: -50px;
    background: rgba(53, 103, 223, 0.22);
    animation: ul-float-a 9s ease-in-out infinite;
}

.ul-login-page::after {
    width: 200px;
    height: 200px;
    left: -55px;
    bottom: -40px;
    background: rgba(23, 163, 110, 0.22);
    animation: ul-float-b 8s ease-in-out infinite;
}

.ul-login-shell {
    width: min(440px, 100%);
    border-radius: 22px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 24px 52px rgba(14, 35, 72, 0.24);
    border: 1px solid rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(6px);
    animation: ul-fade-up 0.55s ease-out;
}

/* بعد از خطای ورود، انیمیشن ورود دوباره پخش نشود (فلیک) */
.ul-login-shell.ul-login-has-error {
    animation: none;
}

.ul-login-logo {
    max-height: 52px;
    width: auto;
}

.ul-login-form-wrap {
    padding: 36px 32px 32px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 250, 255, 0.98) 100%);
}

.ul-login-title {
    font-size: 1.55rem;
    font-weight: 800;
    margin-bottom: 4px;
    color: #112342;
    text-align: center;
}

.ul-login-subtitle {
    color: #4d638f;
    margin-bottom: 24px;
    font-size: 0.94rem;
    font-weight: 500;
    text-align: center;
}

.ul-login-field {
    margin-bottom: 14px;
}

.ul-login-field .form-label {
    color: #233e6f;
    font-weight: 700;
}

.ul-login-field .input-group-text {
    background: #f5f8ff;
    border-color: #d9e2f2;
    color: #4d6290;
}

.ul-login-field .form-control {
    border-color: #d9e2f2;
    padding: 0.72rem 0.85rem;
    font-size: 0.95rem;
    background: #fff;
}

.ul-login-field .form-control:focus {
    border-color: #5a84ea;
    box-shadow: 0 0 0 0.2rem rgba(90, 132, 234, 0.18);
}

.ul-login-remember {
    margin: 6px 0 18px;
}

.ul-login-remember .form-check-label {
    color: #3d5480;
    font-weight: 600;
}

.ul-login-submit {
    width: 100%;
    border: 0;
    border-radius: 12px;
    padding: 0.78rem 1rem;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #3567df 0%, #1ca56f 100%);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ul-login-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(46, 95, 197, 0.22);
    color: #fff;
}

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

.ul-login-validation ul {
    margin: 0;
    padding-right: 18px;
}

.ul-login-validation {
    border: 1px solid #efb4b4 !important;
    background: linear-gradient(180deg, #fff5f5 0%, #ffecec 100%) !important;
    color: #8a1f1f !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 18px rgba(200, 63, 63, 0.12);
}

.ul-login-validation strong {
    font-weight: 800;
}

.ul-login-validation i {
    color: #d94b4b;
    font-size: 1rem;
}

.ul-error-shake {
    animation: ul-shake 0.6s ease-in-out;
}

.ul-error-pop {
    animation: none;
}

@media (prefers-reduced-motion: no-preference) {
    .ul-login-validation.ul-error-pop {
        animation: ul-pop-in 0.25s ease-out;
    }
}

@keyframes ul-bg-pan {
    0% { background-position: 0% 0%, 100% 0%, 50% 100%, 50% 50%; }
    100% { background-position: 6% 4%, 94% 6%, 52% 96%, 46% 48%; }
}

@keyframes ul-float-a {
    0%, 100% { transform: translateY(0px); opacity: 0.85; }
    50% { transform: translateY(16px); opacity: 1; }
}

@keyframes ul-float-b {
    0%, 100% { transform: translateY(0px); opacity: 0.85; }
    50% { transform: translateY(-14px); opacity: 1; }
}

@keyframes ul-fade-up {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes ul-shake {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-7px); }
    30% { transform: translateX(6px); }
    45% { transform: translateX(-4px); }
    60% { transform: translateX(4px); }
    75% { transform: translateX(-2px); }
    90% { transform: translateX(2px); }
}

@keyframes ul-pop-in {
    from { opacity: 0; transform: translateY(-4px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 767.98px) {
    .ul-login-page {
        padding: 12px;
    }

    .ul-login-shell {
        border-radius: 16px;
        width: 100%;
    }

    .ul-login-form-wrap {
        padding: 28px 20px 24px;
    }

    .ul-login-title {
        font-size: 1.35rem;
    }

    .ul-login-logo {
        max-height: 44px;
    }
}

/* Theme sync with main panel */
body.dark-mode .ul-login-page {
    background:
        radial-gradient(circle at 12% 20%, rgba(72, 104, 191, 0.32), transparent 46%),
        radial-gradient(circle at 84% 18%, rgba(20, 134, 95, 0.27), transparent 43%),
        radial-gradient(circle at 72% 84%, rgba(29, 107, 185, 0.2), transparent 40%),
        linear-gradient(160deg, #10192b 0%, #152239 50%, #162b43 100%);
}

body.dark-mode .ul-login-shell {
    background: rgba(20, 32, 54, 0.92);
    border-color: rgba(82, 106, 151, 0.34);
    box-shadow: 0 22px 48px rgba(0, 0, 0, 0.45);
}

body.dark-mode .ul-login-form-wrap {
    background: linear-gradient(180deg, rgba(23, 36, 59, 0.97) 0%, rgba(20, 33, 54, 0.97) 100%);
}

body.dark-mode .ul-login-title {
    color: #e3ebff;
}

body.dark-mode .ul-login-subtitle {
    color: #9eb3d9;
}

body.dark-mode .ul-login-field .form-label {
    color: #d2dffc;
}

body.dark-mode .ul-login-field .input-group-text {
    background: #1e3150;
    border-color: #38517b;
    color: #c4d7ff;
}

body.dark-mode .ul-login-field .form-control {
    background: #1a2b47;
    border-color: #39527c;
    color: #e4edff;
}

body.dark-mode .ul-login-field .form-control::placeholder {
    color: #92a7cc;
}

body.dark-mode .ul-login-field .form-control:focus {
    border-color: #6794ff;
    box-shadow: 0 0 0 0.2rem rgba(103, 148, 255, 0.22);
}

body.dark-mode .ul-login-remember .form-check-label {
    color: #c6d6f5;
}

body.dark-mode .ul-login-validation {
    border-color: #7f2f3b !important;
    background: linear-gradient(180deg, #3b1f2b 0%, #341b26 100%) !important;
    color: #ffdbe0 !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

body.dark-mode .ul-login-validation i {
    color: #ff8d9f;
}

.ul-login-captcha .ul-captcha-row {
    display: grid;
    gap: 10px;
}

.ul-captcha-image-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.ul-captcha-image {
    border-radius: 10px;
    border: 1px solid #c9d7f0;
    background: #f5f8fc;
    height: 64px;
    width: 200px;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

.ul-captcha-refresh {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid #c9d7f0;
    background: #eef3fb;
    color: #2f4f8c;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s ease, transform .15s ease;
}

.ul-captcha-refresh:hover {
    background: #e2ebf8;
    transform: rotate(-20deg);
}

.ul-captcha-refresh:disabled {
    opacity: .6;
    cursor: wait;
}

.ul-captcha-input .form-control {
    letter-spacing: 0.12em;
    font-weight: 700;
    text-transform: uppercase;
}

body.dark-mode .ul-captcha-image {
    border-color: #38517b;
    background: #1a2b47;
}

body.dark-mode .ul-captcha-refresh {
    border-color: #38517b;
    background: #1e3150;
    color: #c4d7ff;
}
