:root {
    --primary: #003b7f;
    --primary-dark: #002855;
    --secondary: #00a8d8;
    --secondary-dark: #0091b3;
    --bg-body: #001524;
    --surface: #ffffff;
    --input-bg: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    --shadow-card: 0 24px 50px -12px rgba(0, 59, 127, 0.12);
    --shadow-soft: 0 8px 20px rgba(0, 0, 0, 0.03);
    --shadow-input: inset 0 2px 4px rgba(0, 0, 0, 0.02);
    --shadow-glow: 0 8px 24px rgba(0, 168, 216, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    scrollbar-gutter: stable;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    align-items: center;
    justify-content: center;
}

form#form1 {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.bg-layer {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    background-color: var(--bg-body);
    background-image: url('../img/cover.jpg');
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center center;
    animation: bgEntrance 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes bgEntrance {
    0% { opacity: 0; transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1); }
}

@media (min-width: 1025px) and (max-width: 1440px) {

    .bg-layer {
        background-position: left center;
    }
}

@media (min-aspect-ratio: 16/9) and (min-width: 1025px) {
    .bg-layer {
        background-position: center center;
    }
}

.bg-layer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 0;
}

.page-wrapper {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 480px;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    will-change: transform, opacity;
    animation: formEntrance 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    animation-delay: 0.1s;
}

@keyframes formEntrance {
    0% { opacity: 0; transform: scale(0.97); }
    100% { opacity: 1; transform: scale(1); }
}

.logo-area {
    display: none;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
}

@media (max-width: 1024px) {
    .logo-area {
        display: flex;
    }

    .page-wrapper {
        max-width: 440px;
    }
}

.logo-box {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.75rem 2.5rem;
    background: #ffffff;
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 8px 32px rgba(0, 59, 127, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transition: box-shadow 0.4s ease, transform 0.4s ease;
}

.logo-box:hover {
    box-shadow: 0 12px 40px rgba(0, 59, 127, 0.12), inset 0 1px 0 rgba(255, 255, 255, 1);
    transform: translateY(-2px);
}

.logo-img {
    height: 76px;
    width: auto;
    display: block;
}

.app-info {
    text-align: center;
    width: 100%;
    background: #ffffff;
    border-radius: 28px 28px 0 0;
    padding: 1.5rem 2.5rem 0.5rem;
    margin-bottom: -1px; /* Prevent subpixel rounding gap */
    max-width: 480px;
    position: relative;
    z-index: 10;
    transform: translateZ(0);
}

.alone-info {
    border-radius: 28px !important;
    padding: 1.5rem 2.5rem !important;
    box-shadow: 0 16px 50px -12px rgba(0, 59, 127, 0.12);
}

.app-info:empty {
    display: none;
    margin: 0;
}

.app-name {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-dark);
    display: block;
}

.app-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
    display: block;
}

.form-card {
    width: 100%;
    background: #ffffff;
    border-radius: 0 0 28px 28px;
    box-shadow: 0 16px 50px -12px rgba(0, 59, 127, 0.12);
    border: none;
    padding: 1rem 2.5rem 2.5rem;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 5;
    transform: translateZ(0);
}

.form-card:has(.login-controls-wrap:empty):has(.button-group:empty) {
    display: none;
}

.server-alert-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.server-alert-icon svg {
    fill: #dc2626;
    width: 100%;
    height: 100%;
}

.server-alert-text {
    font-size: 0.875rem;
    color: #991b1b;
    font-weight: 500;
    line-height: 1.5;
    word-break: break-word;
}

.login-controls-wrap {
    width: 100%;
}

.login-controls-wrap .modern-input {
    width: 100%;
    height: 52px;
    padding: 0 1rem 0 3rem;
    font-size: 0.9375rem;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text-primary);
    background-color: var(--input-bg);
    border: 2px solid transparent;
    border-radius: 14px;
    box-shadow: var(--shadow-input);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon-wrapper .input-icon {
    position: absolute;
    left: 1rem;
    color: #64748b;
    pointer-events: none;
    z-index: 10;
    transition: color 0.3s ease;
}

.login-controls-wrap .modern-input:hover {
    background-color: #e8ecf1;
}

.login-controls-wrap .modern-input:focus {
    outline: none;
    background-color: var(--surface);
    border-color: var(--secondary);
    box-shadow: 0 0 0 4px rgba(0, 168, 216, 0.1), var(--shadow-soft);
    transform: translateY(-1px);
}

.input-icon-wrapper .modern-input:focus+.input-icon,
.input-icon-wrapper .modern-input:focus-within~.input-icon {
    color: var(--secondary);
}

.login-controls-wrap .modern-input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0px 1000px var(--surface) inset;
    -webkit-text-fill-color: var(--text-primary);
    transition: background-color 5000s ease-in-out 0s;
}

.login-controls-wrap label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: 0.01em;
}

.login-controls-wrap .form-group,
.login-controls-wrap .control-group,
.login-controls-wrap .form-inline>div {
    margin-bottom: 1.25rem;
    position: relative;
}

.login-controls-wrap .control-group:last-of-type {
    margin-bottom: 0;
}

.login-controls-wrap .controls,
.login-controls-wrap .input-wrapper {
    position: relative;
}

.login-controls-wrap select {
    width: 100%;
    height: 52px;
    padding: 0 2.5rem 0 1rem;
    font-size: 0.9375rem;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text-primary);
    background-color: var(--input-bg);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1.2rem center;
    background-size: 16px;
    border: 2px solid transparent;
    border-radius: 14px;
    box-shadow: var(--shadow-input);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.login-controls-wrap select:hover {
    background-color: #e8ecf1;
}

.login-controls-wrap select:focus {
    outline: none;
    background-color: var(--surface);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300A8D8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 15l-6-6-6 6'/%3E%3C/svg%3E");
    border-color: var(--secondary);
    box-shadow: 0 0 0 4px rgba(0, 168, 216, 0.1), var(--shadow-soft);
    transform: translateY(-1px);
}

.login-controls-wrap span[id$="lblMessage"]:not(:empty) {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--primary-dark);
    margin-bottom: 0.25rem;
    padding: 0.875rem 1rem;
    background: rgba(0, 168, 216, 0.08);
    border-radius: 12px;
    border-left: 4px solid var(--secondary);
}

.form-card .control-label {
    float: none !important;
    width: auto !important;
}

.form-card .controls {
    margin-left: 0 !important;
}

.form-card .form-inline {
    display: block !important;
}

.captcha-group {
    margin-top: 2rem;
    margin-bottom: 1.25rem;
    padding: 1.25rem;
    background: #f8fafc;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.captcha-group table {
    width: 100% !important;
    display: block !important;
}

.captcha-group tbody,
.captcha-group tr,
.captcha-group td {
    display: block !important;
    width: 100% !important;
    padding: 0 !important;
    border: none !important;
}

.captcha-group .FormPortalTableHeaderEx {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.captcha-group span[id$="ctlInformation"] {
    display: block !important;
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.5rem;
    margin-bottom: 1.25rem;
    line-height: 1.4;
}

.captcha-group span[id$="ctlRandomImage"] {
    display: flex;
    justify-content: center;
    background: #fff;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    padding: 0.5rem;
    margin-top: 0.5rem;
}

.captcha-group img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    display: block;
    margin: 0 auto;
}

.captcha-group input[type="text"] {
    width: 100% !important;
    height: 48px !important;
    padding: 0 1rem !important;
    font-size: 16px !important;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    color: var(--text-primary) !important;
    background-color: var(--surface) !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 12px !important;
    transition: all 0.3s !important;
    box-sizing: border-box !important;
}

.captcha-group input[type="text"]:focus {
    outline: none !important;
    border-color: var(--secondary) !important;
    box-shadow: 0 0 0 4px rgba(0, 168, 216, 0.1) !important;
}

.login-controls-wrap input[type="submit"]:not(.btn-hidden-asp) {
    height: 52px;
    width: 100% !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-dark) 100%);
    color: #fff;
    box-shadow: var(--shadow-glow);
    padding: 0;
    margin-top: 0.5rem;
}

.login-controls-wrap input[type="submit"]:not(.btn-hidden-asp):hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0, 168, 216, 0.38);
}

.login-controls-wrap input[type="submit"]:not(.btn-hidden-asp):active {
    transform: translateY(0);
    box-shadow: var(--shadow-glow);
}

.login-controls-wrap .pnl-message {
    margin-bottom: 1.25rem;
}

.login-controls-wrap .pnl-message .alert-danger {
    padding: 1rem 1.25rem 1rem 3rem;
    border-radius: 16px;
    background: #fef2f2;
    border: 1px solid rgba(254, 202, 202, 0.8);
    box-shadow: 0 8px 24px rgba(220, 38, 38, 0.04), inset 0 1px 1px rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
    color: #991b1b;
    font-weight: 500;
    line-height: 1.5;
    position: relative;
}

.login-controls-wrap .pnl-message .alert-danger::before {
    content: "";
    position: absolute;
    left: 1rem;
    top: 1.05rem;
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23dc2626'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: 100%;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    margin-top: 1.75rem;
}

.btn-visual {
    height: 52px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    user-select: none;
}

.btn-visual span,
.btn-visual svg {
    position: relative;
    z-index: 1;
    pointer-events: none;
}

.btn-visual::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    transform: translate(-50%, -50%);
    transition: width 0.55s ease, height 0.55s ease;
}

.btn-visual:hover::before {
    width: 500px;
    height: 500px;
}

.btn-visual-primary {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-dark) 100%);
    color: #fff;
    box-shadow: var(--shadow-glow);
}

.btn-visual-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0, 168, 216, 0.38);
}

.btn-visual-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-glow);
}

.btn-visual-secondary {
    background: #d0011b;
    color: #fff;
}

.btn-visual-secondary:hover {
    background: #b3000f;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(208, 1, 27, 0.28);
}

.btn-visual-secondary:active {
    transform: translateY(0);
    background: #d0011b;
    box-shadow: none;
}

.edevlet-icon {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border-radius: 5px;
}

.btn-hidden-asp {
    display: none !important;
}

.divider {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    margin: 1.25rem 0;
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    font-weight: 500;
}

.divider::before,
.divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

.server-alert {
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1.25rem;
    border-radius: 16px;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 5;
}

.server-alert-danger {
    background: #fef2f2;
    border: 1px solid rgba(254, 202, 202, 0.8);
    box-shadow: 0 8px 24px rgba(220, 38, 38, 0.04), inset 0 1px 1px rgba(255, 255, 255, 0.8);
}

.form-card:has(.login-controls-wrap:empty):has(.button-group:empty) .server-alert {
    margin-bottom: 0;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-top: none;
    box-shadow: none;
}

.general-alert {
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: 16px;
    margin-bottom: 1rem;
    background: #fef2f2;
    border: 1px solid rgba(254, 202, 202, 0.8);
    box-shadow: 0 8px 24px rgba(220, 38, 38, 0.04), inset 0 1px 1px rgba(255, 255, 255, 0.8);
}

.alone-info~.general-alert,
.form-card[style*="display: none"]~.general-alert,
.form-card:has(.login-controls-wrap:empty):has(.button-group:empty)~.general-alert {
    margin-top: 1.5rem;
}

.general-alert-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    margin-top: 0.05rem;
}

.general-alert-icon svg {
    fill: #dc2626;
    width: 100%;
    height: 100%;
}

.general-alert-text {
    font-size: 0.875rem;
    color: #7f1d1d;
    font-weight: 500;
    line-height: 1.6;
    word-break: break-word;
}

.general-alert-text b,
.general-alert-text strong {
    color: #991b1b;
    font-weight: 700;
}

.general-alert-text ul {
    margin: 0.375rem 0 0 1rem;
    padding: 0;
}

.general-alert-text ul li {
    margin-bottom: 0.2rem;
}


@media (max-width: 520px) {
    .page-wrapper {
        padding: 1.5rem 1rem;
        justify-content: flex-start;
        align-items: stretch;
    }

    .logo-area {
        margin-bottom: 1.25rem;
    }

    .logo-box {
        padding: 1.25rem 1.75rem;
        border-radius: 18px;
    }

    .logo-img {
        height: 56px;
    }

    .app-info {
        padding: 1.25rem 1.25rem 0.5rem;
        border-radius: 20px 20px 0 0;
    }

    .alone-info {
        border-radius: 20px !important;
        padding: 1.25rem 1.25rem !important;
    }

    .form-card {
        padding: 1.25rem 1.25rem;
        border-radius: 0 0 20px 20px;
        margin-bottom: 1rem;
    }

    .login-controls-wrap .modern-input,
    .login-controls-wrap select {
        height: 48px;
        font-size: 16px;
        /* iOS Auto-zoom fix */
    }

    .btn-visual,
    .login-controls-wrap input[type="submit"]:not(.btn-hidden-asp) {
        height: 48px;
        font-size: 0.9375rem;
        border-radius: 12px;
    }

    .button-group {
        gap: 0.75rem;
        margin-top: 1.5rem;
    }

    .server-alert,
    .general-alert {
        padding: 0.875rem 1rem;
        border-radius: 14px;
    }

    .app-name {
        font-size: 1.125rem;
    }

    .app-desc {
        font-size: 0.8125rem;
    }
}

@media (max-width: 380px) {
    .page-wrapper {
        padding: 1rem 0.75rem;
    }

    .logo-box {
        padding: 1rem 1.25rem;
        border-radius: 16px;
    }

    .logo-img {
        height: 48px;
    }

    .app-info {
        padding: 1rem 1rem 0.5rem;
        border-radius: 16px 16px 0 0;
    }

    .alone-info {
        border-radius: 16px !important;
        padding: 1rem 1rem !important;
    }

    .form-card {
        padding: 1.25rem 1rem;
        border-radius: 0 0 16px 16px;
    }

    .login-controls-wrap .modern-input,
    .login-controls-wrap select {
        height: 44px;
        font-size: 16px;
        /* iOS Auto-zoom fix */
    }

    .btn-visual,
    .login-controls-wrap input[type="submit"]:not(.btn-hidden-asp) {
        height: 44px;
        font-size: 0.875rem;
        gap: 0.5rem;
    }

    .edevlet-icon {
        width: 22px;
        height: 22px;
    }

    .button-group {
        gap: 0.625rem;
        margin-top: 1.25rem;
    }

    .login-controls-wrap .control-group {
        margin-bottom: 1rem;
    }
}

@media (max-height: 700px) {
    .page-wrapper {
        justify-content: flex-start;
        padding-top: 1.25rem;
    }

    .logo-area {
        margin-bottom: 1rem;
    }

    .logo-box {
        padding: 0.875rem 1.5rem;
    }

    .logo-img {
        height: 48px;
    }

    .form-card {
        padding: 1.25rem 1.25rem;
        margin-bottom: 0.875rem;
    }

    .button-group {
        margin-top: 1rem;
        gap: 0.625rem;
    }
}

*:focus-visible {
    outline: none;
}

.login-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(0, 15, 45, 0.85) 0%, rgba(0, 27, 71, 0.75) 100%);
    backdrop-filter: blur(28px) saturate(1.2);
    -webkit-backdrop-filter: blur(28px) saturate(1.2);
    animation: overlayFadeIn 0.3s ease;
}

@keyframes overlayFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.ll-fullscreen-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    animation: containerSlideUp 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ll-fullscreen-container svg {
    animation: svgBreath 2.8s ease-in-out infinite;
}

@keyframes svgBreath {
    0%,100% { filter: drop-shadow(0 0 10px rgba(0, 168, 216, 0.4)); }
    50%     { filter: drop-shadow(0 0 35px rgba(0, 168, 216, 0.95)); }
}

@keyframes containerSlideUp {
    from { transform: translateY(16px) scale(0.96); opacity: 0; }
    to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

@keyframes llOrbit {
    to { stroke-dashoffset: -440; }
}

@keyframes llPulse {
    0%,100% { transform: scale(1); }
    50%     { transform: scale(0.91); }
}

.login-loading-text {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: rgba(255, 255, 255, 0.92);
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.btn-visual.btn-loading {
    opacity: 0.95;
    pointer-events: none;
    cursor: not-allowed;
}

.btn-visual.btn-loading svg {
    display: none;
}

.btn-visual.btn-loading::after {
    content: "";
    position: relative;
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255,255,255,0.30);
    border-top-color: #fff;
    border-radius: 50%;
    animation: llBtnSpin 0.72s linear infinite;
    z-index: 2;
}

@keyframes llBtnSpin {
    to { transform: rotate(360deg); }
}