﻿.form-header { text-align: center; margin-bottom: 36px; }
    .form-header-icon {
        width: 56px; height: 56px;
        background: linear-gradient(135deg, #4361ee, #3a86ff);
        border-radius: 16px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-bottom: 20px;
        box-shadow: 0 8px 24px rgba(67, 97, 238, 0.35);
        animation: iconBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    @keyframes iconBounce {
        from { opacity: 0; transform: scale(0.5) translateY(20px); }
        to { opacity: 1; transform: scale(1) translateY(0); }
    }

    .form-header-icon svg { width: 26px; height: 26px; color: #fff; }
    .form-header h2 {
        font-size: 24px;
        font-weight: 800;
        color: #1a1f3c;
        margin-bottom: 8px;
        letter-spacing: -0.3px;
    }
    .form-header p { font-size: 14px; color: #6b7280; }

    .alert-danger-custom {
        background: linear-gradient(135deg, #fef2f2, #fff5f5);
        border: 1px solid #fecaca;
        border-left: 4px solid #ef4444;
        border-radius: 10px;
        padding: 14px 16px;
        margin-bottom: 24px;
        display: flex;
        align-items: center;
        gap: 10px;
        color: #991b1b;
        font-size: 13px;
        animation: slideDown 0.35s ease-out;
    }
    .alert-danger-custom svg { width: 18px; height: 18px; flex-shrink: 0; color: #ef4444; }

    .input-group-custom {
        position: relative;
        margin-bottom: 22px;
        animation: fadeUp 0.4s ease-out both;
    }

    .input-group-custom:nth-child(1) { animation-delay: 0.1s; }
    .input-group-custom:nth-child(2) { animation-delay: 0.2s; }

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

    .input-group-custom label {
        display: block;
        font-size: 13px;
        font-weight: 600;
        color: #374151;
        margin-bottom: 8px;
    }

    .input-wrapper {
        position: relative;
        display: flex;
        align-items: center;
    }

    .input-wrapper .input-icon {
        position: absolute;
        left: 14px;
        width: 18px; height: 18px;
        color: #9ca3af;
        pointer-events: none;
        transition: all 0.25s;
    }

    .input-wrapper input:focus ~ .input-icon,
    .input-wrapper input:focus + .input-icon {
        color: #4361ee;
        transform: scale(1.1);
    }

    .input-wrapper input {
        width: 100%;
        padding: 13px 14px 13px 44px;
        border: 2px solid #e5e7eb;
        border-radius: 12px;
        font-size: 14px;
        color: #1f2937;
        background: #fafafa;
        outline: none;
        transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .input-wrapper input:focus {
        border-color: #4361ee;
        background: #fff;
        box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.1);
    }

    .input-wrapper input:hover:not(:focus) {
        border-color: #d1d5db;
        background: #f9fafb;
    }

    .input-wrapper input::placeholder { color: #c0c4cc; }

    .pwd-toggle {
        position: absolute;
        right: 12px;
        width: 32px; height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        border-radius: 8px;
        transition: all 0.25s;
        color: #9ca3af;
    }

    .pwd-toggle:hover {
        color: #4361ee;
        background: rgba(67, 97, 238, 0.08);
    }

    .pwd-toggle svg { width: 18px; height: 18px; transition: all 0.25s; }

    .pwd-toggle .icon-hide { display: none; }
    .pwd-toggle.active .icon-show { display: none; }
    .pwd-toggle.active .icon-hide { display: block; }
    .pwd-toggle.active { color: #4361ee; }

    #password { padding-right: 52px; }

    .form-options {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 24px;
        font-size: 13px;
    }

    .remember-me {
        display: flex;
        align-items: center;
        gap: 6px;
        color: #6b7280;
        cursor: pointer;
        user-select: none;
    }

    .remember-me input {
        width: 15px; height: 15px;
        accent-color: #4361ee;
        cursor: pointer;
    }

    .form-footer { margin-top: 28px; animation: fadeUp 0.4s ease-out 0.3s both; }

    .captcha-row {
        display: flex;
        gap: 10px;
        align-items: stretch;
    }

    .captcha-img {
        height: 44px;
        border-radius: 12px;
        cursor: pointer;
        border: 2px solid #e5e7eb;
        transition: border-color 0.2s;
    }
    .captcha-img:hover { border-color: #4361ee; }

    .captcha-refresh {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 0 14px;
        background: #f8fafc;
        border: 2px solid #e5e7eb;
        border-radius: 12px;
        cursor: pointer;
        font-size: 15px;
        font-weight: 700;
        color: #1f2937;
        letter-spacing: 2px;
        user-select: none;
        transition: all 0.2s;
        white-space: nowrap;
        font-family: 'SF Mono', Monaco, Consolas, monospace;
    }

    .captcha-refresh:hover {
        border-color: #4361ee;
        background: #f0f4ff;
    }

    .captcha-refresh svg {
        color: #9ca3af;
        flex-shrink: 0;
    }

    .captcha-refresh:hover svg {
        color: #4361ee;
    }

    .btn-submit {
        width: 100%;
        padding: 14px 20px;
        background: linear-gradient(135deg, #4361ee, #3a86ff);
        color: #fff;
        border: none;
        border-radius: 12px;
        font-size: 15px;
        font-weight: 700;
        cursor: pointer;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 4px 15px rgba(67, 97, 238, 0.35);
        letter-spacing: 0.5px;
        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;
    }

    .btn-submit:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 25px rgba(67, 97, 238, 0.45);
    }

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

    .btn-submit:active {
        transform: translateY(0);
        box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
    }

    .btn-submit:disabled {
        opacity: 0.7;
        cursor: not-allowed;
        transform: none;
    }

    .form-divider {
        display: flex;
        align-items: center;
        margin: 28px 0 22px;
    }

    .form-divider::before, .form-divider::after {
        content: '';
        flex: 1;
        height: 1px;
        background: linear-gradient(90deg, transparent, #e5e7eb, transparent);
    }

    .form-divider span {
        padding: 0 14px;
        font-size: 12px;
        color: #9ca3af;
        text-transform: uppercase;
        letter-spacing: 1px;
    }

    .form-hint {
        margin-top: 0;
        font-size: 13px;
        color: #9ca3af;
        text-align: center;
        line-height: 1.6;
    }

    .form-hint svg {
        width: 14px; height: 14px;
        display: inline-block;
        vertical-align: -2px;
        margin-right: 4px;
    }

    /* Loading state */
    .btn-submit.loading {
        pointer-events: none;
        opacity: 0.8;
    }

    .btn-submit.loading::after {
        content: '';
        width: 18px; height: 18px;
        border: 2px solid rgba(255,255,255,0.3);
        border-top-color: #fff;
        border-radius: 50%;
        animation: spin 0.6s linear infinite;
        display: inline-block;
        vertical-align: middle;
        margin-left: 8px;
    }

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

    /* Mobile optimizations */
    @media (max-width: 768px) {
        .form-header { margin-bottom: 24px; }
        .form-header-icon { width: 44px; height: 44px; margin-bottom: 14px; border-radius: 12px; }
        .form-header-icon svg { width: 20px; height: 20px; }
        .form-header h2 { font-size: 20px; margin-bottom: 4px; }
        .form-header p { font-size: 13px; }
        .input-group-custom { margin-bottom: 16px; }
        .input-group-custom label { font-size: 12px; margin-bottom: 6px; }
        .input-wrapper input { padding: 12px 12px 12px 40px; font-size: 15px; border-radius: 10px; }
        .btn-submit { padding: 14px; font-size: 16px; border-radius: 10px; }
        .captcha-row { gap: 8px; }
        .captcha-img { height: 42px; border-radius: 10px; }
        .login-mode-toggle { margin-bottom: 16px; padding: 2px; }
        .login-mode-btn { padding: 10px 0; font-size: 14px; }
        .form-divider { margin: 20px 0 16px; }
        .form-hint { font-size: 12px; }
        .login-qr-body canvas { max-width: 200px; height: auto; }
    }

    @media (max-width: 480px) {
        .login-mode-toggle { margin-bottom: 16px; padding: 3px; border-radius: 10px; background: #f1f5f9; }
        .login-mode-btn { padding: 9px 0; font-size: 13px; font-weight: 600; border-radius: 8px; }

        .form-header { text-align: left; margin-bottom: 16px; }
        .form-header-icon { display: none; }
        .form-header h2 { font-size: 18px; font-weight: 700; color: #0f172a; margin-bottom: 2px; }
        .form-header p { font-size: 12px; color: #94a3b8; }

        .input-group-custom { margin-bottom: 14px; }
        .input-group-custom label { font-size: 12px; font-weight: 600; color: #334155; margin-bottom: 5px; }
        .input-wrapper input {
            padding: 12px 12px 12px 40px; font-size: 16px; border-radius: 10px;
            border: 1.5px solid #e2e8f0; background: #f8fafc; color: #0f172a;
        }
        .input-wrapper input:focus { border-color: #4361ee; background: #fff; box-shadow: 0 0 0 3px rgba(67,97,238,0.1); }
        .input-wrapper input::placeholder { color: #cbd5e1; }
        .input-wrapper .input-icon { left: 12px; width: 18px; height: 18px; color: #94a3b8; }
        .input-wrapper input:focus ~ .input-icon, .input-wrapper input:focus + .input-icon { color: #4361ee; }

        .pwd-toggle { width: 34px; height: 34px; right: 4px; border-radius: 8px; color: #94a3b8; }
        .pwd-toggle:hover { color: #4361ee; background: rgba(67,97,238,0.06); }
        .pwd-toggle svg { width: 18px; height: 18px; }
        #password { padding-right: 48px; }

        .captcha-row { gap: 8px; }
        .captcha-img { height: 42px; border-radius: 10px; border: 1.5px solid #e2e8f0; }

        .btn-submit {
            width: 100%; padding: 13px; font-size: 15px; font-weight: 700;
            border-radius: 10px; margin-top: 6px;
            background: linear-gradient(135deg, #4361ee 0%, #3b82f6 100%);
            box-shadow: 0 4px 16px rgba(67,97,238,0.35);
        }
        .btn-submit:hover { box-shadow: 0 6px 24px rgba(67,97,238,0.45); transform: translateY(-1px); }

        .form-divider { margin: 16px 0 12px; }
        .form-divider span { font-size: 11px; color: #cbd5e1; letter-spacing: 0.5px; }
        .form-divider::before, .form-divider::after { background: linear-gradient(90deg, transparent, #e2e8f0, transparent); }
        .form-hint { font-size: 11px; color: #94a3b8; line-height: 1.5; }
        .form-hint svg { width: 12px; height: 12px; color: #cbd5e1; }

        .alert-danger-custom { padding: 10px 12px; font-size: 12px; border-radius: 8px; margin-bottom: 12px; border-left: 3px solid #ef4444; }
        .alert-danger-custom svg { width: 16px; height: 16px; }

        .login-qr-body { padding: 16px; }
        .login-qr-body canvas { max-width: 180px; height: auto; border-radius: 10px; }
        .login-qr-body .qr-hint { font-size: 12px; margin-top: 10px; color: #94a3b8; }
    }

/* Dark mode */
[data-theme="dark"] .login-container{background:linear-gradient(135deg,#0f172a 0%,#1e293b 100%)}
[data-theme="dark"] .brand-panel{background:linear-gradient(135deg,#0f172a 0%,#1a1f3c 100%)}
[data-theme="dark"] .form-panel{background:#1a1d2e}
[data-theme="dark"] .form-header h2{color:#e5e7eb}
[data-theme="dark"] .form-header p{color:#94a3b8}
[data-theme="dark"] .input-wrapper input{background:#252836;color:#e5e7eb;border-color:#3a3d4e}
[data-theme="dark"] .input-wrapper input:focus{background:#2a2d3e;border-color:#6366f1}
[data-theme="dark"] .input-wrapper .input-icon{color:#64748b}
[data-theme="dark"] .captcha-refresh{background:#252836;color:#94a3b8;border-color:#3a3d4e}
[data-theme="dark"] .remember-me{color:#94a3b8}
[data-theme="dark"] .remember-me input{accent-color:#6366f1}
[data-theme="dark"] .form-hint{color:#64748b}

.back-home{display:inline-flex;align-items:center;gap:4px;font-size:13px;font-weight:500;color:#64748b;text-decoration:none !important;margin-bottom:20px;transition:color .15s}
.back-home:hover{color:#4f46e5}
[data-theme="dark"] .alert-danger{background:#7f1d1d;color:#fecaca;border-color:#dc2626}